Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: rename zap_page_range_single() to zap_vma_range()

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>

authored by

David Hildenbrand (Arm) and committed by
Andrew Morton
0326440c 784a742e

+22 -22
+1 -1
arch/s390/mm/gmap_helpers.c
··· 89 89 if (!vma) 90 90 return; 91 91 if (!is_vm_hugetlb_page(vma)) 92 - zap_page_range_single(vma, vmaddr, min(end, vma->vm_end) - vmaddr); 92 + zap_vma_range(vma, vmaddr, min(end, vma->vm_end) - vmaddr); 93 93 vmaddr = vma->vm_end; 94 94 } 95 95 }
+2 -2
drivers/android/binder/page_range.rs
··· 130 130 pid: Pid, 131 131 /// The mm for the relevant process. 132 132 mm: ARef<Mm>, 133 - /// Used to synchronize calls to `vm_insert_page` and `zap_page_range_single`. 133 + /// Used to synchronize calls to `vm_insert_page` and `zap_vma_range`. 134 134 #[pin] 135 135 mm_lock: Mutex<()>, 136 136 /// Spinlock protecting changes to pages. ··· 762 762 if let Some(unchecked_vma) = mmap_read.vma_lookup(vma_addr) { 763 763 if let Some(vma) = check_vma(unchecked_vma, range_ptr) { 764 764 let user_page_addr = vma_addr + (page_index << PAGE_SHIFT); 765 - vma.zap_page_range_single(user_page_addr, PAGE_SIZE); 765 + vma.zap_vma_range(user_page_addr, PAGE_SIZE); 766 766 } 767 767 } 768 768
+1 -1
drivers/android/binder_alloc.c
··· 1185 1185 if (vma) { 1186 1186 trace_binder_unmap_user_start(alloc, index); 1187 1187 1188 - zap_page_range_single(vma, page_addr, PAGE_SIZE); 1188 + zap_vma_range(vma, page_addr, PAGE_SIZE); 1189 1189 1190 1190 trace_binder_unmap_user_end(alloc, index); 1191 1191 }
+2 -2
include/linux/mm.h
··· 2804 2804 2805 2805 void zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, 2806 2806 unsigned long size); 2807 - void zap_page_range_single(struct vm_area_struct *vma, unsigned long address, 2807 + void zap_vma_range(struct vm_area_struct *vma, unsigned long address, 2808 2808 unsigned long size); 2809 2809 /** 2810 2810 * zap_vma - zap all page table entries in a vma ··· 2812 2812 */ 2813 2813 static inline void zap_vma(struct vm_area_struct *vma) 2814 2814 { 2815 - zap_page_range_single(vma, vma->vm_start, vma->vm_end - vma->vm_start); 2815 + zap_vma_range(vma, vma->vm_start, vma->vm_end - vma->vm_start); 2816 2816 } 2817 2817 struct mmu_notifier_range; 2818 2818
+1 -1
kernel/bpf/arena.c
··· 656 656 guard(mutex)(&arena->lock); 657 657 /* iterate link list under lock */ 658 658 list_for_each_entry(vml, &arena->vma_list, head) 659 - zap_page_range_single(vml->vma, uaddr, PAGE_SIZE * page_cnt); 659 + zap_vma_range(vml->vma, uaddr, PAGE_SIZE * page_cnt); 660 660 } 661 661 662 662 static void arena_free_pages(struct bpf_arena *arena, long uaddr, long page_cnt, bool sleepable)
+1 -1
kernel/events/core.c
··· 7213 7213 #ifdef CONFIG_MMU 7214 7214 /* Clear any partial mappings on error. */ 7215 7215 if (err) 7216 - zap_page_range_single(vma, vma->vm_start, nr_pages * PAGE_SIZE); 7216 + zap_vma_range(vma, vma->vm_start, nr_pages * PAGE_SIZE); 7217 7217 #endif 7218 7218 7219 7219 return err;
+2 -2
mm/madvise.c
··· 832 832 * Application no longer needs these pages. If the pages are dirty, 833 833 * it's OK to just throw them away. The app will be more careful about 834 834 * data it wants to keep. Be sure to free swap resources too. The 835 - * zap_page_range_single call sets things up for shrink_active_list to actually 835 + * zap_vma_range call sets things up for shrink_active_list to actually 836 836 * free these pages later if no one else has touched them in the meantime, 837 837 * although we could add these pages to a global reuse list for 838 838 * shrink_active_list to pick up before reclaiming other pages. ··· 1191 1191 * OK some of the range have non-guard pages mapped, zap 1192 1192 * them. This leaves existing guard pages in place. 1193 1193 */ 1194 - zap_page_range_single(vma, range->start, range->end - range->start); 1194 + zap_vma_range(vma, range->start, range->end - range->start); 1195 1195 } 1196 1196 1197 1197 /*
+7 -7
mm/memory.c
··· 2215 2215 } 2216 2216 2217 2217 /** 2218 - * zap_page_range_single - remove user pages in a given range 2219 - * @vma: vm_area_struct holding the applicable pages 2220 - * @address: starting address of pages to zap 2218 + * zap_vma_range - zap all page table entries in a vma range 2219 + * @vma: the vma covering the range to zap 2220 + * @address: starting address of the range to zap 2221 2221 * @size: number of bytes to zap 2222 2222 * 2223 - * The range must fit into one VMA. 2223 + * The provided address range must be fully contained within @vma. 2224 2224 */ 2225 - void zap_page_range_single(struct vm_area_struct *vma, unsigned long address, 2225 + void zap_vma_range(struct vm_area_struct *vma, unsigned long address, 2226 2226 unsigned long size) 2227 2227 { 2228 2228 struct mmu_gather tlb; ··· 2250 2250 !(vma->vm_flags & VM_PFNMAP)) 2251 2251 return; 2252 2252 2253 - zap_page_range_single(vma, address, size); 2253 + zap_vma_range(vma, address, size); 2254 2254 } 2255 2255 EXPORT_SYMBOL_GPL(zap_vma_ptes); 2256 2256 ··· 3018 3018 * maintain page reference counts, and callers may free 3019 3019 * pages due to the error. So zap it early. 3020 3020 */ 3021 - zap_page_range_single(vma, addr, size); 3021 + zap_vma_range(vma, addr, size); 3022 3022 return error; 3023 3023 } 3024 3024
+3 -3
net/ipv4/tcp.c
··· 2105 2105 maybe_zap_len = total_bytes_to_map - /* All bytes to map */ 2106 2106 *length + /* Mapped or pending */ 2107 2107 (pages_remaining * PAGE_SIZE); /* Failed map. */ 2108 - zap_page_range_single(vma, *address, maybe_zap_len); 2108 + zap_vma_range(vma, *address, maybe_zap_len); 2109 2109 err = 0; 2110 2110 } 2111 2111 ··· 2113 2113 unsigned long leftover_pages = pages_remaining; 2114 2114 int bytes_mapped; 2115 2115 2116 - /* We called zap_page_range_single, try to reinsert. */ 2116 + /* We called zap_vma_range, try to reinsert. */ 2117 2117 err = vm_insert_pages(vma, *address, 2118 2118 pending_pages, 2119 2119 &pages_remaining); ··· 2270 2270 total_bytes_to_map = avail_len & ~(PAGE_SIZE - 1); 2271 2271 if (total_bytes_to_map) { 2272 2272 if (!(zc->flags & TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT)) 2273 - zap_page_range_single(vma, address, total_bytes_to_map); 2273 + zap_vma_range(vma, address, total_bytes_to_map); 2274 2274 zc->length = total_bytes_to_map; 2275 2275 zc->recv_skip_hint = 0; 2276 2276 } else {
+2 -2
rust/kernel/mm/virt.rs
··· 113 113 /// kernel goes further in freeing unused page tables, but for the purposes of this operation 114 114 /// we must only assume that the leaf level is cleared. 115 115 #[inline] 116 - pub fn zap_page_range_single(&self, address: usize, size: usize) { 116 + pub fn zap_vma_range(&self, address: usize, size: usize) { 117 117 let (end, did_overflow) = address.overflowing_add(size); 118 118 if did_overflow || address < self.start() || self.end() < end { 119 119 // TODO: call WARN_ONCE once Rust version of it is added ··· 123 123 // SAFETY: By the type invariants, the caller has read access to this VMA, which is 124 124 // sufficient for this method call. This method has no requirements on the vma flags. The 125 125 // address range is checked to be within the vma. 126 - unsafe { bindings::zap_page_range_single(self.as_ptr(), address, size) }; 126 + unsafe { bindings::zap_vma_range(self.as_ptr(), address, size) }; 127 127 } 128 128 129 129 /// If the [`VM_MIXEDMAP`] flag is set, returns a [`VmaMixedMap`] to this VMA, otherwise