[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220126165939.reu2pu6wztmr274f@revolver>
Date: Wed, 26 Jan 2022 16:59:46 +0000
From: Liam Howlett <liam.howlett@...cle.com>
To: Vlastimil Babka <vbabka@...e.cz>
CC: "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>,
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 58/66] mm/mremap: Use vma_find() instead of vma linked
list
* Vlastimil Babka <vbabka@...e.cz> [220120 07:27]:
> On 12/1/21 15:30, Liam Howlett wrote:
> > From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
> >
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
>
> Acked-by: Vlastimil Babka <vbabka@...e.cz>
>
> > ---
> > mm/mremap.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/mm/mremap.c b/mm/mremap.c
> > index b09e107cd18b..4ad39c985d04 100644
> > --- a/mm/mremap.c
> > +++ b/mm/mremap.c
> > @@ -713,7 +713,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,
> > if (excess) {
> > vma->vm_flags |= VM_ACCOUNT;
> > if (split)
> > - vma->vm_next->vm_flags |= VM_ACCOUNT;
> > + find_vma(mm, vma->vm_end)->vm_flags |= VM_ACCOUNT;
> > }
> >
> > return new_addr;
> > @@ -869,9 +869,11 @@ static unsigned long mremap_to(unsigned long addr, unsigned long old_len,
> > static int vma_expandable(struct vm_area_struct *vma, unsigned long delta)
> > {
> > unsigned long end = vma->vm_end + delta;
> > + struct vm_area_struct *next;
> > if (end < vma->vm_end) /* overflow */
> > return 0;
> > - if (vma->vm_next && vma->vm_next->vm_start < end) /* intersection */
> > + next = find_vma(vma->vm_mm, vma->vm_end);
> > + if (next && next->vm_start < end) /* intersection */
>
> Could just use find_vma_intersection()?
Yes! Then next is not needed. That will be nice.
>
> > return 0;
> > if (get_unmapped_area(NULL, vma->vm_start, end - vma->vm_start,
> > 0, MAP_FIXED) & ~PAGE_MASK)
>
Powered by blists - more mailing lists