[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250617154345.2494405-1-david@redhat.com>
Date: Tue, 17 Jun 2025 17:43:31 +0200
From: David Hildenbrand <david@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org,
nvdimm@...ts.linux.dev,
David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
Dan Williams <dan.j.williams@...el.com>,
Alistair Popple <apopple@...dia.com>,
Matthew Wilcox <willy@...radead.org>,
Jan Kara <jack@...e.cz>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
Zi Yan <ziy@...dia.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Nico Pache <npache@...hat.com>,
Ryan Roberts <ryan.roberts@....com>,
Dev Jain <dev.jain@....com>,
Barry Song <baohua@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>,
Jann Horn <jannh@...gle.com>,
Pedro Falcato <pfalcato@...e.de>
Subject: [PATCH RFC 00/14] mm: vm_normal_page*() + CoW PFNMAP improvements
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 ;)
Of course, we add sanity checks that nobody dares installing PFNMAPs of
anonymous folios in these configs, that could trick us in assuming that
these are due to CoW.
We only have to do that without support for pte_special(); for
architectures that support pte_special(), nothing changes.
In the same process, add vm_normal_page_pud(), which is easy after the
cleanups, and improve our documentation. Well, and clarify that
"vm_ops->find_special_page" XEN thingy.
Briefly tested on UML (making sure vm_normal_page() still works as expected
without pte_special() support) and on x86-64 with a bunch of tests
(including ndctl, and cow.c which tests the huge zero folio).
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Juergen Gross <jgross@...e.com>
Cc: Stefano Stabellini <sstabellini@...nel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Alistair Popple <apopple@...dia.com>
Cc: Matthew Wilcox <willy@...radead.org>
Cc: Jan Kara <jack@...e.cz>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Christian Brauner <brauner@...nel.org>
Cc: Zi Yan <ziy@...dia.com>
Cc: Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: "Liam R. Howlett" <Liam.Howlett@...cle.com>
Cc: Nico Pache <npache@...hat.com>
Cc: Ryan Roberts <ryan.roberts@....com>
Cc: Dev Jain <dev.jain@....com>
Cc: Barry Song <baohua@...nel.org>
Cc: Vlastimil Babka <vbabka@...e.cz>
Cc: Mike Rapoport <rppt@...nel.org>
Cc: Suren Baghdasaryan <surenb@...gle.com>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Jann Horn <jannh@...gle.com>
Cc: Pedro Falcato <pfalcato@...e.de>
David Hildenbrand (14):
mm/memory: drop highest_memmap_pfn sanity check in vm_normal_page()
mm: drop highest_memmap_pfn
mm: compare pfns only if the entry is present when inserting
pfns/pages
mm/huge_memory: move more common code into insert_pmd()
mm/huge_memory: move more common code into insert_pud()
mm/huge_memory: support huge zero folio in vmf_insert_folio_pmd()
fs/dax: use vmf_insert_folio_pmd() to insert the huge zero folio
mm/huge_memory: mark PMD mappings of the huge zero folio special
mm/memory: introduce is_huge_zero_pfn() and use it in
vm_normal_page_pmd()
mm/memory: factor out common code from vm_normal_page_*()
mm: remove "horrible special case to handle copy-on-write behaviour"
mm: drop addr parameter from vm_normal_*_pmd()
mm: introduce and use vm_normal_page_pud()
mm: rename vm_ops->find_special_page() to vm_ops->find_normal_page()
drivers/xen/Kconfig | 1 +
drivers/xen/gntdev.c | 5 +-
fs/dax.c | 47 ++----
fs/proc/task_mmu.c | 6 +-
include/linux/huge_mm.h | 12 +-
include/linux/mm.h | 41 +++--
mm/Kconfig | 2 +
mm/huge_memory.c | 135 +++++++---------
mm/internal.h | 2 -
mm/memory.c | 261 ++++++++++++++++---------------
mm/mm_init.c | 3 -
mm/nommu.c | 1 -
mm/pagewalk.c | 22 +--
tools/testing/vma/vma_internal.h | 18 ++-
14 files changed, 281 insertions(+), 275 deletions(-)
base-commit: 2f24ee10fe6d1959d674a4298d63b66f54508a68
--
2.49.0
Powered by blists - more mailing lists