Re: [PATCH mm-new 1/1] mm/khugepaged: abort collapse scan on non-swap entries
From: David Hildenbrand
Date: Wed Sep 24 2025 - 06:11:36 EST
On 24.09.25 12:02, Lance Yang wrote:
From: Lance Yang <lance.yang@xxxxxxxxx>
The existing check in hpage_collapse_scan_pmd() is specific to uffd-wp
markers. Other special markers (e.g., GUARD, POISONED) would not be caught
early, leading to failures deeper in the swap-in logic.
hpage_collapse_scan_pmd()
`- collapse_huge_page()
`- __collapse_huge_page_swapin() -> fails!
As David suggested[1], this patch skips any such non-swap entries early.
If a special marker is found, the scan is aborted immediately with the
SCAN_PTE_NON_PRESENT result, as Lorenzo suggested[2], avoiding wasted
work.
Note that I suggested to skip all non-present entries except swap
entries, which includes migration entries, hwpoisoned entries etc.
--
Cheers
David / dhildenb