Re: [PATCH 1/6] mm/compaction: wait for pfn walkers before poisoning offlined memmap

From: David Hildenbrand (Arm)

Date: Tue Oct 27 2026 - 09:39:13 EST


On 10/27/26 05:21, Gregory Price (Meta) wrote:
> Compaction checks that a pageblock is online, then uses its pages across
> lock drops and sleeps. If offline poisons the memmap meanwhile, a
> DEBUG_VM kernel faults:
>
> CPU 1 (compaction) CPU 2 (offline_pages)
> pageblock_pfn_to_page()
> block is online
> isolate_migratepages_block()
> cond_resched()
> offline_mem_sections()
> remove_pfn_range_from_zone()
> page_init_poison()
> set_pageblock_skip(valid_page)
> reads the zone of a poisoned page
>
> Oops: general protection fault, probably for non-canonical address 0xdffffc00000006a2
> RIP: 0010:set_pfnblock_bit+0xa6/0x2b0
> isolate_migratepages_block+0x2456/0x3c80
> compact_zone+0x1638/0x3900
> compact_node+0x12a/0x1f0
> sysctl_compaction_handler+0xec/0x160
>
> The free scanner faults the same way. A contiguous zone skips the
> online check, since offline clears zone->contiguous only after
> poisoning.
>
> Hold an SRCU-fast read section (pfn_walk) from the block check to the
> last use of its pages, and make remove_pfn_range_from_zone() clear
> zone->contiguous and wait for it before poisoning. Offline pays one
> grace period per range.
>
> Scanner positions outlive the section, and offline can shrink the zone
> meanwhile, so take the contiguous fast path only inside the current
> span, publish zone->contiguous with release, and keep the migrate
> scanner inside the zone.
>
> With a kprobe parking the migrate scanner across the offline, base
> faults in 3 of 3 runs and this patch in none. Unforced offline/online
> cycling under compaction faults in 8 of 24 runs on base and 0 of 12 with
> this patch.
>
> Fixes: d33695b16a9f ("mm/memory_hotplug: poison memmap in remove_pfn_range_from_zone()")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> ---

BTW, the order of these patches is all wrong.

There are much more important fixes hiding in this series. And this change here
would certainly not be the first thing we'd backport.

Please create a proper series that only addresses the pfn_to_online_page()
situation, without different, more urgent fixes.

Because there is no way we will fast track anything like this here into stable
kernels.

--
Cheers,

David