On 17.06.25 17:43, David Hildenbrand wrote:
RFC because it's based on mm-new where some things might still change
around the devmap removal stuff.
While removing support for CoW PFNMAPs is a noble goal, I am not even sure
if we can remove said support for e.g., /dev/mem that easily.
In the end, Cow PFNMAPs are pretty simple: everything is "special" except
CoW'ed anon folios, that are "normal".
The only complication is: how to identify such pages without pte_special().
Because with pte_special(), it's easy.
Well, of course, one day all architectures might support pte_special() ...
either because we added support for pte_special() or removed support for
... these architectures from Linux.
No need to wait for that day. Let's do some cleanups around
vm_normal_page()/vm_normal_page_pmd() and handling of the huge zero folio,
and remove the "horrible special case to handle copy-on-write behaviour"
that does questionable things in remap_pfn_range() with a VMA, simply by
... looking for anonymous folios in CoW PFNMAPs to identify anonymous
folios? I know, sounds crazy ;)
I'll mention one corner case that just occurred to me: assume someone
maps arbitrary /dev/mem that is actually used by the kernel for user
space, and then some of that memory gets allocated as anonymous memory,
it would probably be a problem.
Hmm, I'll have to think about that, and the interaction with
CONFIG_STRICT_DEVMEM.