Re: [PATCH v3] mm/memory hotplug/unplug: Optimize zone contiguous check when changing pfn range

From: David Hildenbrand (Arm)

Date: Thu Apr 16 2026 - 03:17:47 EST


On 4/16/26 04:23, Wei Yang wrote:
> On Tue, Apr 07, 2026 at 11:16:15PM -0400, Yuan Liu wrote:
> [...]
>>
>> /*
>> @@ -956,9 +957,22 @@ static void __init memmap_init_zone_range(struct zone *zone,
>> memmap_init_range(end_pfn - start_pfn, nid, zone_id, start_pfn,
>> zone_end_pfn, MEMINIT_EARLY, NULL, MIGRATE_MOVABLE,
>> false);
>> + zone->pages_with_online_memmap += end_pfn - start_pfn;
>>
>> - if (*hole_pfn < start_pfn)
>> - init_unavailable_range(*hole_pfn, start_pfn, zone_id, nid);
>> + if (*hole_pfn < start_pfn) {
>> + unsigned long pgcnt;
>> +
>> + if (*hole_pfn < zone_start_pfn) {
>> + init_unavailable_range(*hole_pfn, zone_start_pfn,
>> + zone_id, nid);
>
> One question here:
>
> init_unavailable_range(zone_id)
> __init_single_page(zone_id)
> set_page_links(zone_id)
> set_page_zone(page, zone_id)
>
> [hole_pfn, zone_start_pfn) doesn't belong to this zone. Would this be
> a problem?
>
> But it seems we have already done this for a long time.

Right, we just want "some" node/zone for holes that are indicated as
having an online memmap.

--
Cheers,

David