diff mbox series

[v2,70/70] mm/mmap: Convert __insert_vm_struct to use mas, convert vma_link to use vma_mas_link()

Message ID 20210112161240.2024684-71-Liam.Howlett@Oracle.com (mailing list archive)
State New, archived
Headers show
Series RFC mm: Introducing the Maple Tree | expand

Commit Message

Liam R. Howlett Jan. 12, 2021, 4:12 p.m. UTC
Drop unused vma_store()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 mm/mmap.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/mm/mmap.c b/mm/mmap.c
index ce8857b9abd89..b4ed8be4899b8 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -514,21 +514,9 @@  static void vma_mas_link(struct mm_struct *mm, struct vm_area_struct *vma,
 
 static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma)
 {
-	struct address_space *mapping = NULL;
+	MA_STATE(mas, &mm->mm_mt, vma->vm_start, vma->vm_end - 1);
 
-	if (vma->vm_file) {
-		mapping = vma->vm_file->f_mapping;
-		i_mmap_lock_write(mapping);
-	}
-
-	vma_mt_store(mm, vma);
-	__vma_link_file(vma);
-
-	if (mapping)
-		i_mmap_unlock_write(mapping);
-
-	mm->map_count++;
-	validate_mm(mm);
+	vma_mas_link(mm, vma, &mas);
 }
 
 /*
@@ -538,9 +526,13 @@  static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma)
 static inline void __insert_vm_struct(struct mm_struct *mm,
 				      struct vm_area_struct *vma)
 {
-	if (find_vma_intersection(mm, vma->vm_start, vma->vm_end))
+	MA_STATE(mas, &mm->mm_mt, vma->vm_start, vma->vm_end - 1);
+
+	if (mas_find(&mas, vma->vm_end - 1))
 		BUG();
-	vma_mt_store(mm, vma);
+
+	mas_set_range(&mas, vma->vm_start, vma->vm_end - 1);
+	vma_mas_store(vma, &mas);
 	mm->map_count++;
 }