Re: [PATCH v4 5/7] mm/khugepaged: Refactor the PTE state checks into a helper
From: David Hildenbrand (Arm)
Date: Wed Aug 12 2026 - 06:13:03 EST
On 8/12/26 11:51, David Hildenbrand (Arm) wrote:
>> Huh, that looks odd.
>>
>> That should just be a VM_WARN_ON_FOLIO(true, ..) or sth like that.
>>
>> But in collapse_scan_pmd() that warning never existed? So this raises eyebrows.
>>
>> [...]
>>
>> I'll play with it to see if we can do better and will reply here later.
>
>
> Okay, I think below is what we should do.
>
> There is one behavioral change: we now longer trace the last folio, which is the right
> thing to do IMHO.
>
> And I think there is one fix we should pull out and evaluate first: A zeropage with a
> uffd-wp marker is not checked properly, IIUC.
I took a closer look. It actually works as expected already, as max_ptes_none is
0 with uffd, and that will include the zeropage.
So we can move the uffd-wp checks into their old place.
(I think I raised before that the max_ptes_none handling with uffd-wp is
actually a bit off. In general, the uffd handling is weird, because even in
missing mode we can collapse shared zeropages just fine)
--
Cheers,
David