Skip to contentSkip to conversation

mm-memory-simplify-calculation-in-unmap_mapping_range_tree.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 29

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/memory: simplify calculation in unmap_mapping_range_tree()
has been removed from the -mm tree. Its filename was
mm-memory-simplify-calculation-in-unmap_mapping_range_tree.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "David Hildenbrand (Arm)" <[email protected]>
Subject: mm/memory: simplify calculation in unmap_mapping_range_tree()
Date: Fri, 27 Feb 2026 21:08:35 +0100

Let's simplify the calculation a bit further to make it easier to get, reusing vma_last_pgoff() which we move from interval_tree.c to mm.h.

Cc Alexander Gordeev <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Alice Ryhl <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc "Borislav Petkov (AMD)" <[email protected]>
Cc Carlos Llamas <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Claudio Imbrenda <[email protected]>
Cc Daniel Borkman <[email protected]>
Cc Dave Airlie <[email protected]>
Cc David Ahern <[email protected]>
Cc David Rientjes <[email protected]>
Cc David S. Miller <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Gerald Schaefer <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Hartley Sweeten <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Ian Abbott <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jakub Kacinski <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Jann Horn <[email protected]>
Cc Janosch Frank <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Jonas Lahtinen <[email protected]>
Cc Leon Romanovsky <[email protected]>
Cc Liam Howlett <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Miguel Ojeda <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Namhyung kim <[email protected]>
Cc Neal Cardwell <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Pedro Falcato <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Shakeel Butt <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Vincenzo Frascino <[email protected]>

---

 include/linux/mm.h |    5 +++++
 mm/interval_tree.c |    5 -----
 mm/memory.c        |   12 +++++-------
 3 files changed, 10 insertions(+), 12 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-memory-simplify-calculation-in-unmap_mapping_range_tree +5 -0
@@ -3969,6 +3969,11 @@ static inline unsigned long vma_pages(co
 	return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
 }
 
+static inline unsigned long vma_last_pgoff(struct vm_area_struct *vma)
+{
+	return vma->vm_pgoff + vma_pages(vma) - 1;
+}
+
 static inline unsigned long vma_desc_size(const struct vm_area_desc *desc)
 {
 	return desc->end - desc->start;
mm/interval_tree.c renamed from mm/interval_tree.c~mm-memory-simplify-calculation-in-unmap_mapping_range_tree +0 -5
@@ -15,11 +15,6 @@ static inline unsigned long vma_start_pg
 	return v->vm_pgoff;
 }
 
-static inline unsigned long vma_last_pgoff(struct vm_area_struct *v)
-{
-	return v->vm_pgoff + vma_pages(v) - 1;
-}
-
 INTERVAL_TREE_DEFINE(struct vm_area_struct, shared.rb,
 		     unsigned long, shared.rb_subtree_last,
 		     vma_start_pgoff, vma_last_pgoff, /* empty */, vma_interval_tree)
mm/memory.c renamed from mm/memory.c~mm-memory-simplify-calculation-in-unmap_mapping_range_tree +5 -7
@@ -4227,17 +4227,15 @@ static inline void unmap_mapping_range_t
 					    struct zap_details *details)
 {
 	struct vm_area_struct *vma;
-	pgoff_t vba, vea, zba, zea;
 	unsigned long start, size;
 	struct mmu_gather tlb;
 
 	vma_interval_tree_foreach(vma, root, first_index, last_index) {
-		vba = vma->vm_pgoff;
-		vea = vba + vma_pages(vma) - 1;
-		zba = max(first_index, vba);
-		zea = min(last_index, vea);
-		start = ((zba - vba) << PAGE_SHIFT) + vma->vm_start;
-		size = (zea - zba + 1) << PAGE_SHIFT;
+		const pgoff_t start_idx = max(first_index, vma->vm_pgoff);
+		const pgoff_t end_idx = min(last_index, vma_last_pgoff(vma)) + 1;
+
+		start = vma->vm_start + ((start_idx - vma->vm_pgoff) << PAGE_SHIFT);
+		size = (end_idx - start_idx) << PAGE_SHIFT;
 
 		tlb_gather_mmu(&tlb, vma->vm_mm);
 		zap_page_range_single_batched(&tlb, vma, start, size, details);

_

Patches currently in -mm which might be from [email protected] are