Commit d0601a50 authored by Liam R. Howlett's avatar Liam R. Howlett Committed by Andrew Morton

mm/mmap: drop range_has_overlap() function

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/20220906194824.2110408-70-Liam.Howlett@oracle.comSigned-off-by: default avatarLiam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
Tested-by: default avatarYu Zhao <yuzhao@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 763ecb03
...@@ -390,30 +390,6 @@ anon_vma_interval_tree_post_update_vma(struct vm_area_struct *vma) ...@@ -390,30 +390,6 @@ anon_vma_interval_tree_post_update_vma(struct vm_area_struct *vma)
anon_vma_interval_tree_insert(avc, &avc->anon_vma->rb_root); 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, static unsigned long count_vma_pages_range(struct mm_struct *mm,
unsigned long addr, unsigned long end) unsigned long addr, unsigned long end)
{ {
...@@ -3178,11 +3154,10 @@ void exit_mmap(struct mm_struct *mm) ...@@ -3178,11 +3154,10 @@ void exit_mmap(struct mm_struct *mm)
*/ */
int insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma) int insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma)
{ {
struct vm_area_struct *prev;
unsigned long charged = vma_pages(vma); unsigned long charged = vma_pages(vma);
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; return -ENOMEM;
if ((vma->vm_flags & VM_ACCOUNT) && if ((vma->vm_flags & VM_ACCOUNT) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment