Re: [PATCH v9] mm/memory hotplug: Fix zone->contiguous always false when hotplug
From: David Hildenbrand (Arm)
Date: Fri Feb 06 2026 - 08:01:36 EST
On 1/30/26 17:06, Tianyou Li wrote:
From: Yuan Liu <yuan1.liu@xxxxxxxxx>
set_zone_contiguous() uses __pageblock_pfn_to_page() to detect
pageblocks that either do not exist (hole) or that do not belong
to the same zone.
__pageblock_pfn_to_page(), however, relies on pfn_to_online_page(),
effectively always returning NULL for memory ranges that were not
onlined yet. So when called on a range-to-be-onlined, it indicates
a memory hole to set_zone_contiguous().
Consequently, the set_zone_contiguous() call in move_pfn_range_to_zone(),
which happens early during memory onlining, will never detect a
zone as being contiguous. Bad: the fast path relies on the zone
contiguous state may skipped.
To fix the issue, move the set_zone_contiguous() call to a later
stage in memory onlining, where pfn_to_online_page() will succeed:
after we mark the memory sections to be online.
Fixes: 2d070eab2e82 ("mm: consider zone which is not fully populated to have holes")
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Reviewed-by: Nanhai Zou <nanhai.zou@xxxxxxxxx>
Signed-off-by: Yuan Liu <yuan1.liu@xxxxxxxxx>
Signed-off-by: Tianyou Li <tianyou.li@xxxxxxxxx>
I assume this one is to be ignored :)
--
Cheers,
David