Re: [PATCH v1] kernel/fork: only call untrack_pfn_clear() on VMAs duplicated for fork()

From: David Hildenbrand
Date: Thu Apr 24 2025 - 08:52:36 EST


But maybe I misunderstand your approach :) Happy to obviously look and if
not like some crazy thing just for PAT (you can understand why I would not
like this) will be supportive :>)

This is something quick (well, longer than I wish it would take) that seems to
work. There are smaller pat-internal cleanups to be had on top of this, and
the new functions shall be documented.


Observe how:
* We remove VM_PAT and that weird VM flags manipulation + "locked" flag
* We remove any traces of the nasty tracking handling from mremap+fork code
* Just like anon_vma_name, it hooks into vm_area_dup()/vm_area_free().
* We remove the page table lookup via get_pat_info()->... completely
* We remove the VMA parameter from PAT code completely
* We reduce the track/untrack/sanitize interface to 3 functions

Yeah this is all lovely!

OK this should hopefully be workable then!

Okay, let me polish that up (and see if there is any reasonable way to split it up), and write some doc+descriptions .. and do some more testing.

The VMA split reproducer is definitely happy with this already.

--
Cheers,

David / dhildenb