RFC mm: vm_normal_page*() + CoW PFNMAP improvements
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest14 patches 50 repliesIn review
Patches in v1 No applies recorded yet
Reviews trailers per patch
10 of 14 patches have a Reviewed-by or Acked-by.
| Patch | Oscar Salvador | Pedro Falcato | Lance Yang | Alistair Popple |
|---|---|---|---|---|
| 1/14 | R-b | R-b | ||
| 2/14 | R-b | R-b | ||
| 3/14 | R-b | R-b | ||
| 4/14 | R-b | R-b | ||
| 5/14 | R-b | R-b | ||
| 6/14 | R-b | |||
| 7/14 | ||||
| 8/14 | R-b | |||
| 9/14 | R-b | |||
| 10/14 | R-b | |||
| 11/14 | ||||
| 12/14 | ||||
| 13/14 | R-b | |||
| 14/14 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [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).
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
Signature · 1 line
2.49.0