Subject: [PATCH v1 00/16] mm: cleanups around unmapping / zapping

From: "David Hildenbrand (Arm)" <[email-masked]>
Date: Fri, 27 Feb 2026 21:08:31 +0100

A bunch of cleanups around unmapping and zapping. Mostly simplifications,
code movements, documentation and renaming of zapping functions.

With this series, we'll have the following high-level zap/unmap functions
(excluding high-level folio zapping):
* unmap_vmas() for actual unmapping (vmas will go away)
* zap_vma(): zap all page table entries in a vma
* zap_vma_for_reaping(): zap_vma() that must not block
* zap_vma_range(): zap a range of page table entries
* zap_vma_range_batched(): zap_vma_range() with more options and batching
* zap_special_vma_range(): limited zap_vma_range() for modules
* __zap_vma_range(): internal helper

Patch #1 is not about unmapping/zapping, but I stumbled over it while
verifying MADV_DONTNEED range handling.

Patch #16 is related to [1], but makes sense even independent of that.

[1] https://lore.kernel.org/r/[email-masked]

The CC list is already long enough. As these are simple changes to
drivers/arch code, I'm only CCing maintainers of all changes but only
reviewers of the MM bits.

Cc: Andrew Morton <[email-masked]>
Cc: Lorenzo Stoakes <[email-masked]>
Cc: "Liam R. Howlett" <[email-masked]>
Cc: Vlastimil Babka <[email-masked]>
Cc: Mike Rapoport <[email-masked]>
Cc: Suren Baghdasaryan <[email-masked]>
Cc: Michal Hocko <[email-masked]>
Cc: Jann Horn <[email-masked]>
Cc: Pedro Falcato <[email-masked]>
Cc: David Rientjes <[email-masked]>
Cc: Shakeel Butt <[email-masked]>
Cc: "Matthew Wilcox (Oracle)" <[email-masked]>
Cc: Alice Ryhl <[email-masked]>
Cc: Madhavan Srinivasan <[email-masked]>
Cc: Michael Ellerman <[email-masked]>
Cc: Christian Borntraeger <[email-masked]>
Cc: Janosch Frank <[email-masked]>
Cc: Claudio Imbrenda <[email-masked]>
Cc: Alexander Gordeev <[email-masked]>
Cc: Gerald Schaefer <[email-masked]>
Cc: Heiko Carstens <[email-masked]>
Cc: Vasily Gorbik <[email-masked]>
Cc: Jarkko Sakkinen <[email-masked]>
Cc: Thomas Gleixner <[email-masked]>
Cc: Ingo Molnar <[email-masked]>
Cc: Borislav Petkov <[email-masked]>
Cc: Greg Kroah-Hartman <[email-masked]>
Cc: "Arve Hjønnevåg" <[email-masked]>
Cc: Todd Kjos <[email-masked]>
Cc: Christian Brauner <[email-masked]>
Cc: Carlos Llamas <[email-masked]>
Cc: Alice Ryhl <[email-masked]>
Cc: Ian Abbott <[email-masked]>
Cc: H Hartley Sweeten <[email-masked]>
Cc: Jani Nikula <[email-masked]>
Cc: Joonas Lahtinen <[email-masked]>
Cc: Rodrigo Vivi <[email-masked]>
Cc: Tvrtko Ursulin <[email-masked]>
Cc: David Airlie <[email-masked]>
Cc: Simona Vetter <[email-masked]>
Cc: Jason Gunthorpe <[email-masked]>
Cc: Leon Romanovsky <[email-masked]>
Cc: Dimitri Sivanich <[email-masked]>
Cc: Arnd Bergmann <[email-masked]>
Cc: Alexei Starovoitov <[email-masked]>
Cc: Daniel Borkmann <[email-masked]>
Cc: Andrii Nakryiko <[email-masked]>
Cc: Peter Zijlstra <[email-masked]>
Cc: Arnaldo Carvalho de Melo <[email-masked]>
Cc: Namhyung Kim <[email-masked]>
Cc: Andy Lutomirski <[email-masked]>
Cc: Vincenzo Frascino <[email-masked]>
Cc: Eric Dumazet <[email-masked]>
Cc: Neal Cardwell <[email-masked]>
Cc: "David S. Miller" <[email-masked]>
Cc: David Ahern <[email-masked]>
Cc: Jakub Kicinski <[email-masked]>
Cc: Paolo Abeni <[email-masked]>
Cc: Miguel Ojeda <[email-masked]>

Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]

David Hildenbrand (Arm) (16):
  mm/madvise: drop range checks in madvise_free_single_vma()
  mm/memory: remove "zap_details" parameter from zap_page_range_single()
  mm/memory: inline unmap_mapping_range_vma() into
    unmap_mapping_range_tree()
  mm/memory: simplify calculation in unmap_mapping_range_tree()
  mm/oom_kill: use MMU_NOTIFY_CLEAR in __oom_reap_task_mm()
  mm/oom_kill: factor out zapping of VMA into zap_vma_for_reaping()
  mm/memory: rename unmap_single_vma() to __zap_vma_range()
  mm/memory: move adjusting of address range to unmap_vmas()
  mm/memory: convert details->even_cows into details->skip_cows
  mm/memory: use __zap_vma_range() in zap_vma_for_reaping()
  mm/memory: inline unmap_page_range() into __zap_vma_range()
  mm: rename zap_vma_pages() to zap_vma()
  mm: rename zap_page_range_single_batched() to zap_vma_range_batched()
  mm: rename zap_page_range_single() to zap_vma_range()
  mm: rename zap_vma_ptes() to zap_special_vma_range()
  mm/memory: support VM_MIXEDMAP in zap_special_vma_range()

 arch/powerpc/platforms/book3s/vas-api.c |   2 +-
 arch/powerpc/platforms/pseries/vas.c    |   2 +-
 arch/s390/mm/gmap_helpers.c             |   2 +-
 arch/x86/kernel/cpu/sgx/encl.c          |   2 +-
 drivers/android/binder/page_range.rs    |   4 +-
 drivers/android/binder_alloc.c          |   2 +-
 drivers/comedi/comedi_fops.c            |   2 +-
 drivers/gpu/drm/i915/i915_mm.c          |   4 +-
 drivers/infiniband/core/uverbs_main.c   |   6 +-
 drivers/misc/sgi-gru/grumain.c          |   2 +-
 include/linux/mm.h                      |  23 ++-
 kernel/bpf/arena.c                      |   3 +-
 kernel/events/core.c                    |   2 +-
 lib/vdso/datastore.c                    |   2 +-
 mm/internal.h                           |   7 +-
 mm/interval_tree.c                      |   5 -
 mm/madvise.c                            |  24 +--
 mm/memory.c                             | 217 ++++++++++++------------
 mm/oom_kill.c                           |  15 +-
 mm/page-writeback.c                     |   2 +-
 net/ipv4/tcp.c                          |   7 +-
 rust/kernel/mm/virt.rs                  |   4 +-
 22 files changed, 162 insertions(+), 177 deletions(-)

base-commit: df9c51269a5e2a6fbca2884a756a4011a5e78748
-- 
2.43.0