[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dd3c0c6a-41d5-ffdb-f361-13fcd7982b6a@suse.cz>
Date: Fri, 21 Jan 2022 10:51:38 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Liam Howlett <liam.howlett@...cle.com>,
"maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Song Liu <songliubraving@...com>,
Davidlohr Bueso <dave@...olabs.net>,
"Paul E . McKenney" <paulmck@...nel.org>,
Matthew Wilcox <willy@...radead.org>,
Laurent Dufour <ldufour@...ux.ibm.com>,
David Rientjes <rientjes@...gle.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Rik van Riel <riel@...riel.com>,
Peter Zijlstra <peterz@...radead.org>,
Michel Lespinasse <walken.cr@...il.com>,
Jerome Glisse <jglisse@...hat.com>,
Minchan Kim <minchan@...gle.com>,
Joel Fernandes <joelaf@...gle.com>,
Rom Lemarchand <romlem@...gle.com>
Subject: Re: [PATCH v4 66/66] mm/mmap: Drop range_has_overlap() function
On 12/1/21 15:30, Liam Howlett wrote:
> From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
>
> Since there is no longer a linked list, the range_has_overlap() function
> is identical to the find_vma_intersection() function. There is only one
> place that actually needs the previous vma, so just use vma_prev() in
> that one case.
I guess that was written before some further changes and now it's removing
just one user that doesn't care about pprev.
> Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
Acked-by: Vlastimil Babka <vbabka@...e.cz>
> ---
> mm/mmap.c | 28 +---------------------------
> 1 file changed, 1 insertion(+), 27 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index e13c6ef76697..4dfe2f92796e 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -420,30 +420,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)
> {
> @@ -3188,9 +3164,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) &&
Powered by blists - more mailing lists