Re: [PATCH v5 0/4] mm/huge_memory: copy PMDs at fork like the PTE path does

From: Konstantin Khorenko

Date: Thu Nov 19 2026 - 05:19:09 EST


On 11/17/26 22:49, David Hildenbrand (Arm) wrote:
> On 11/4/26 21:40, Konstantin Khorenko wrote:
>> copy_huge_pmd() decides what to copy at fork by its own rules, apart
>> from copy_present_ptes(): a lockless check for special PMDs, and a skip
>> of every file THP. Following David's review of v3, this series makes it
>> decide the way the PTE path does, under the page table lock, with
>> vm_normal_page_pmd(). That fixes the two bugs v1-v3 were about. The
>> patches:
>>
>> 1. folio_dup_file_rmap_pmd() duplicated a PMD mapping as HPAGE_PMD_NR
>> PTE mappings. It had no caller until patch 2.
>> 2. File THPs are copied at fork instead of being refaulted by the
>> child, as their PTEs would be.
>> 3. The special-PMD read moves under the lock. That closes the race with
>> a driver zap (vfio-pci, panthor) and the missing page table deposit
>> on ppc64 hash that Sashiko found in v1.
>> 4. A selftest for 1 and 2.
>>
>
> Okay, the refcount overflow patches are now upstream.
>
> Can you rebase against
>
> git://git.kernel.org/pub/scm/linux/kernel/git/mm/core.git for-next
>
> and resend?
Sure, will do right now!


Cheers, Konstantin