]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/mmap: drop range_has_overlap() function
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 14 Apr 2022 06:07:24 +0000 (23:07 -0700)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 14 Apr 2022 21:49:49 +0000 (17:49 -0400)
Since there is no longer a linked list, the range_has_overlap() function
is identical to the find_vma_intersection() function.

Link: https://lkml.kernel.org/r/20220404143501.2016403-70-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c

index c2a8b46dbc31ad10fe8dd0e4df13b1e45071a438..287a6256ca5e2c86e40851d3d001f1511212a782 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -440,30 +440,6 @@ anon_vma_interval_tree_post_update_vma(struct vm_area_struct *vma)
                anon_vma_interval_tree_insert(avc, &avc->anon_vma->rb_root);
 }
 
-/*
- * range_has_overlap() - Check the @start - @end range for overlapping VMAs and
- * sets up a pointer to the previous VMA
- * @mm: the mm struct
- * @start: the start address of the range
- * @end: the end address of the range
- * @pprev: the pointer to the pointer of the previous VMA
- *
- * Returns: True if there is an overlapping VMA, false otherwise
- */
-static inline
-bool range_has_overlap(struct mm_struct *mm, unsigned long start,
-                      unsigned long end, struct vm_area_struct **pprev)
-{
-       struct vm_area_struct *existing;
-
-       MA_STATE(mas, &mm->mm_mt, start, start);
-       rcu_read_lock();
-       existing = mas_find(&mas, end - 1);
-       *pprev = mas_prev(&mas, 0);
-       rcu_read_unlock();
-       return existing ? true : false;
-}
-
 static unsigned long count_vma_pages_range(struct mm_struct *mm,
                unsigned long addr, unsigned long end)
 {
@@ -3195,9 +3171,7 @@ void exit_mmap(struct mm_struct *mm)
  */
 int insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma)
 {
-       struct vm_area_struct *prev;
-
-       if (range_has_overlap(mm, vma->vm_start, vma->vm_end, &prev))
+       if (find_vma_intersection(mm, vma->vm_start, vma->vm_end))
                return -ENOMEM;
 
        if ((vma->vm_flags & VM_ACCOUNT) &&