]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: rename zap_page_range_single() to zap_vma_range()
authorDavid Hildenbrand (Arm) <david@kernel.org>
Fri, 27 Feb 2026 20:08:45 +0000 (21:08 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:15 +0000 (13:53 -0700)
Let's rename it to make it better match our new naming scheme.

While at it, polish the kerneldoc.

[akpm@linux-foundation.org: fix rustfmtcheck]
Link: https://lkml.kernel.org/r/20260227200848.114019-15-david@kernel.org
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Acked-by: Puranjay Mohan <puranjay@kernel.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Arve <arve@android.com>
Cc: "Borislav Petkov (AMD)" <bp@alien8.de>
Cc: Carlos Llamas <cmllamas@google.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Daniel Borkman <daniel@iogearbox.net>
Cc: Dave Airlie <airlied@gmail.com>
Cc: David Ahern <dsahern@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jakub Kacinski <kuba@kernel.org>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Jann Horn <jannh@google.com>
Cc: Janosch Frank <frankja@linux.ibm.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Namhyung kim <namhyung@kernel.org>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Todd Kjos <tkjos@android.com>
Cc: Tvrtko Ursulin <tursulin@ursulin.net>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/s390/mm/gmap_helpers.c
drivers/android/binder/page_range.rs
drivers/android/binder_alloc.c
include/linux/mm.h
kernel/bpf/arena.c
kernel/events/core.c
mm/madvise.c
mm/memory.c
net/ipv4/tcp.c
rust/kernel/mm/virt.rs

index ae2d59a19313fe37d429b3d8cd4de60a69856eb8..f8789ffcc05ca7e5ff3b07d200c79011cd232017 100644 (file)
@@ -89,7 +89,7 @@ void gmap_helper_discard(struct mm_struct *mm, unsigned long vmaddr, unsigned lo
                if (!vma)
                        return;
                if (!is_vm_hugetlb_page(vma))
-                       zap_page_range_single(vma, vmaddr, min(end, vma->vm_end) - vmaddr);
+                       zap_vma_range(vma, vmaddr, min(end, vma->vm_end) - vmaddr);
                vmaddr = vma->vm_end;
        }
 }
index 9dfc154e5dd4e889c4f3aa89e5edb89434113e1a..8882fd18d9f3fef66ca41a84ff9c2401c9c8f5b3 100644 (file)
@@ -130,7 +130,7 @@ pub(crate) struct ShrinkablePageRange {
     pid: Pid,
     /// The mm for the relevant process.
     mm: ARef<Mm>,
-    /// Used to synchronize calls to `vm_insert_page` and `zap_page_range_single`.
+    /// Used to synchronize calls to `vm_insert_page` and `zap_vma_range`.
     #[pin]
     mm_lock: Mutex<()>,
     /// Spinlock protecting changes to pages.
@@ -762,7 +762,7 @@ unsafe extern "C" fn rust_shrink_free_page(
     if let Some(unchecked_vma) = mmap_read.vma_lookup(vma_addr) {
         if let Some(vma) = check_vma(unchecked_vma, range_ptr) {
             let user_page_addr = vma_addr + (page_index << PAGE_SHIFT);
-            vma.zap_page_range_single(user_page_addr, PAGE_SIZE);
+            vma.zap_vma_range(user_page_addr, PAGE_SIZE);
         }
     }
 
index dd2046bd5cdee7beba245087235c0b193153b6fd..e4488ad86a6557de266c500e0aac54cd5b69de96 100644 (file)
@@ -1185,7 +1185,7 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
        if (vma) {
                trace_binder_unmap_user_start(alloc, index);
 
-               zap_page_range_single(vma, page_addr, PAGE_SIZE);
+               zap_vma_range(vma, page_addr, PAGE_SIZE);
 
                trace_binder_unmap_user_end(alloc, index);
        }
index 60c13d40c65ca95047ee74a737e05a15ad934090..10a5b9ba4eeb0ac6dad335d7d6d0b3625dcb8033 100644 (file)
@@ -2804,7 +2804,7 @@ struct page *vm_normal_page_pud(struct vm_area_struct *vma, unsigned long addr,
 
 void zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
                  unsigned long size);
-void zap_page_range_single(struct vm_area_struct *vma, unsigned long address,
+void zap_vma_range(struct vm_area_struct *vma, unsigned long address,
                           unsigned long size);
 /**
  * zap_vma - zap all page table entries in a vma
@@ -2812,7 +2812,7 @@ void zap_page_range_single(struct vm_area_struct *vma, unsigned long address,
  */
 static inline void zap_vma(struct vm_area_struct *vma)
 {
-       zap_page_range_single(vma, vma->vm_start, vma->vm_end - vma->vm_start);
+       zap_vma_range(vma, vma->vm_start, vma->vm_end - vma->vm_start);
 }
 struct mmu_notifier_range;
 
index 19cca936eb9dd22f8a7869e9e3cbb0ca90b559a9..08d008cc471e6b13e4755dacb10d630b4cf7ff22 100644 (file)
@@ -656,7 +656,7 @@ static void zap_pages(struct bpf_arena *arena, long uaddr, long page_cnt)
        guard(mutex)(&arena->lock);
        /* iterate link list under lock */
        list_for_each_entry(vml, &arena->vma_list, head)
-               zap_page_range_single(vml->vma, uaddr, PAGE_SIZE * page_cnt);
+               zap_vma_range(vml->vma, uaddr, PAGE_SIZE * page_cnt);
 }
 
 static void arena_free_pages(struct bpf_arena *arena, long uaddr, long page_cnt, bool sleepable)
index 2ecdaabf1b4ddcc4a1d986fb8b6b02724c22d648..d5b21077e8298ac96b9eac58b436376631fe36ea 100644 (file)
@@ -7213,7 +7213,7 @@ static int map_range(struct perf_buffer *rb, struct vm_area_struct *vma)
 #ifdef CONFIG_MMU
        /* Clear any partial mappings on error. */
        if (err)
-               zap_page_range_single(vma, vma->vm_start, nr_pages * PAGE_SIZE);
+               zap_vma_range(vma, vma->vm_start, nr_pages * PAGE_SIZE);
 #endif
 
        return err;
index a50ec5f90e3e2a5acc40b21415eb06abe3dd884c..afe0f01765c4bad9e527e81be9e49971b8be202f 100644 (file)
@@ -832,7 +832,7 @@ static int madvise_free_single_vma(struct madvise_behavior *madv_behavior)
  * Application no longer needs these pages.  If the pages are dirty,
  * it's OK to just throw them away.  The app will be more careful about
  * data it wants to keep.  Be sure to free swap resources too.  The
- * zap_page_range_single call sets things up for shrink_active_list to actually
+ * zap_vma_range call sets things up for shrink_active_list to actually
  * free these pages later if no one else has touched them in the meantime,
  * although we could add these pages to a global reuse list for
  * shrink_active_list to pick up before reclaiming other pages.
@@ -1191,7 +1191,7 @@ static long madvise_guard_install(struct madvise_behavior *madv_behavior)
                 * OK some of the range have non-guard pages mapped, zap
                 * them. This leaves existing guard pages in place.
                 */
-               zap_page_range_single(vma, range->start, range->end - range->start);
+               zap_vma_range(vma, range->start, range->end - range->start);
        }
 
        /*
index 879858e466ef28a1c7b9d28d610ce6f836fedf5a..dd80fbf6473a456664ce7ea7774fcfec3c481207 100644 (file)
@@ -2215,14 +2215,14 @@ void zap_vma_range_batched(struct mmu_gather *tlb,
 }
 
 /**
- * zap_page_range_single - remove user pages in a given range
- * @vma: vm_area_struct holding the applicable pages
- * @address: starting address of pages to zap
+ * zap_vma_range - zap all page table entries in a vma range
+ * @vma: the vma covering the range to zap
+ * @address: starting address of the range to zap
  * @size: number of bytes to zap
  *
- * The range must fit into one VMA.
+ * The provided address range must be fully contained within @vma.
  */
-void zap_page_range_single(struct vm_area_struct *vma, unsigned long address,
+void zap_vma_range(struct vm_area_struct *vma, unsigned long address,
                unsigned long size)
 {
        struct mmu_gather tlb;
@@ -2250,7 +2250,7 @@ void zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
                        !(vma->vm_flags & VM_PFNMAP))
                return;
 
-       zap_page_range_single(vma, address, size);
+       zap_vma_range(vma, address, size);
 }
 EXPORT_SYMBOL_GPL(zap_vma_ptes);
 
@@ -3018,7 +3018,7 @@ static int remap_pfn_range_notrack(struct vm_area_struct *vma, unsigned long add
         * maintain page reference counts, and callers may free
         * pages due to the error. So zap it early.
         */
-       zap_page_range_single(vma, addr, size);
+       zap_vma_range(vma, addr, size);
        return error;
 }
 
index 89c962672e51725141068673c8f88f0428f54b7a..9573ce9b0ac19c7c6ec4ef67e26a6e38efc04aad 100644 (file)
@@ -2105,7 +2105,7 @@ static int tcp_zerocopy_vm_insert_batch_error(struct vm_area_struct *vma,
                maybe_zap_len = total_bytes_to_map -  /* All bytes to map */
                                *length + /* Mapped or pending */
                                (pages_remaining * PAGE_SIZE); /* Failed map. */
-               zap_page_range_single(vma, *address, maybe_zap_len);
+               zap_vma_range(vma, *address, maybe_zap_len);
                err = 0;
        }
 
@@ -2113,7 +2113,7 @@ static int tcp_zerocopy_vm_insert_batch_error(struct vm_area_struct *vma,
                unsigned long leftover_pages = pages_remaining;
                int bytes_mapped;
 
-               /* We called zap_page_range_single, try to reinsert. */
+               /* We called zap_vma_range, try to reinsert. */
                err = vm_insert_pages(vma, *address,
                                      pending_pages,
                                      &pages_remaining);
@@ -2270,7 +2270,7 @@ static int tcp_zerocopy_receive(struct sock *sk,
        total_bytes_to_map = avail_len & ~(PAGE_SIZE - 1);
        if (total_bytes_to_map) {
                if (!(zc->flags & TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT))
-                       zap_page_range_single(vma, address, total_bytes_to_map);
+                       zap_vma_range(vma, address, total_bytes_to_map);
                zc->length = total_bytes_to_map;
                zc->recv_skip_hint = 0;
        } else {
index 6bfd91cfa1f4694663782cc5fd1d42b558f326c6..63eb730b0b0553076c981148de513a375b76a6b3 100644 (file)
@@ -113,7 +113,7 @@ impl VmaRef {
     /// kernel goes further in freeing unused page tables, but for the purposes of this operation
     /// we must only assume that the leaf level is cleared.
     #[inline]
-    pub fn zap_page_range_single(&self, address: usize, size: usize) {
+    pub fn zap_vma_range(&self, address: usize, size: usize) {
         let (end, did_overflow) = address.overflowing_add(size);
         if did_overflow || address < self.start() || self.end() < end {
             // TODO: call WARN_ONCE once Rust version of it is added
@@ -123,7 +123,7 @@ impl VmaRef {
         // SAFETY: By the type invariants, the caller has read access to this VMA, which is
         // sufficient for this method call. This method has no requirements on the vma flags. The
         // address range is checked to be within the vma.
-        unsafe { bindings::zap_page_range_single(self.as_ptr(), address, size) };
+        unsafe { bindings::zap_vma_range(self.as_ptr(), address, size) };
     }
 
     /// If the [`VM_MIXEDMAP`] flag is set, returns a [`VmaMixedMap`] to this VMA, otherwise