Re: [PATCH v3 43/47] mm/huge_memory: split huge PUDs when adjusting VMA boundaries
From: David Hildenbrand (Arm)
Date: Wed Nov 04 2026 - 04:17:07 EST
On 11/4/26 04:12, Lance Yang wrote:
>
> On Sat, Oct 31, 2026 at 10:40:12AM +0100, David Hildenbrand (Arm) wrote:
>> PFN mappings such as VFIO PCI BAR mappings can use PUD leaves while
>> allowing VMA splits at page granularity. However, vma_adjust_trans_huge()
>> only handles PMDs.
>>
>> After faulting a writable PUD-sized VFIO BAR mapping, changing its first
>> page to read-only with mprotect() makes the PMD walk treat the PUD leaf
>> as a PMD table. Applying MADV_DONTFORK to the first PMD-sized chunk leaves
>> the PUD spanning two VMAs: the PMD-aligned boundary skips splitting.
>>
>> Walk the page tables once at each adjusted boundary and split a huge
>> PUD or PMD leaf as needed. Handle PUD leaves even when the boundary is
>> PMD-aligned.
>>
>> Fixes: f9e54c3a2f5b7 ("vfio/pci: implement huge_fault support")
>> Cc: stable@xxxxxxxxxxxxxxx
>> Tested-by: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
>> Reviewed-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
>> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>> ---
>
> Nice work!
>
> Reviewed-by: Lance Yang <lance.yang@xxxxxxxxx>
Thanks for the review! Please do keep reviewing, but note that more trailers
(including this one) will likely not make it upstream as I am about to prepare
the PR to get most of these things here upstream.
--
Cheers,
David