[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABi2SkW1Au3WZ6Qem=FppOFBGRn3GDJo5+U3yXpk2brK9MR8NQ@mail.gmail.com>
Date: Thu, 17 Oct 2024 11:15:20 -0700
From: Jeff Xu <jeffxu@...omium.org>
To: "Liam R. Howlett" <Liam.Howlett@...cle.com>, Jeff Xu <jeffxu@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Jann Horn <jannh@...gle.com>, David Hildenbrand <david@...hat.com>,
Qi Zheng <zhengqi.arch@...edance.com>, Kefeng Wang <wangkefeng.wang@...wei.com>,
Pedro Falcato <pedro.falcato@...il.com>
Subject: Re: [PATCH 1/2] mm/mremap: Clean up vma_to_resize()
On Thu, Oct 17, 2024 at 11:07 AM Liam R. Howlett
<Liam.Howlett@...cle.com> wrote:
>
> * Jeff Xu <jeffxu@...omium.org> [241017 13:55]:
> > On Wed, Oct 16, 2024 at 1:17 PM Liam R. Howlett <Liam.Howlett@...cle.com> wrote:
> > >
> > > From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
> > >
> > > vma_to_resize() is used in two locations to find and validate the vma
> > > for the mremap location. One of the two locations already has the vma,
> > > which is then re-found to validate the same vma.
> > >
> > > This code can be simplified by moving the vma_lookup() from
> > > vma_to_resize() to mremap_to() and changing the return type to an int
> > > error.
> > >
> > > Since the function now just validates the vma, the function is renamed
> > > to mremap_vma_check() to better reflect what it is doing.
> > >
> > > Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
> > > ---
> > > mm/mremap.c | 39 +++++++++++++++++++--------------------
> > > 1 file changed, 19 insertions(+), 20 deletions(-)
> > >
> > > diff --git a/mm/mremap.c b/mm/mremap.c
> > > index 5917feafe8cc..648c29f568af 100644
> > > --- a/mm/mremap.c
> > > +++ b/mm/mremap.c
> > > @@ -826,17 +826,12 @@ static unsigned long move_vma(struct vm_area_struct *vma,
> > > return new_addr;
> > > }
> > >
> > > -static struct vm_area_struct *vma_to_resize(unsigned long addr,
> > > +static int mremap_vma_check(struct vm_area_struct *vma, unsigned long addr,
> > The original function is vma_to_resize, and mremap_vma_check is
> > missing this context.
> > Maybe mremap_vma_check_resize is a better name ?
>
> Good point. That suggestion is long though. Perhaps
> vma_check_resize(), since this is a static function in the mremap.c
> file, it is fine to drop mremap from the name.
>
I'm ok with that.
> ...
>
> Thanks,
> Liam
Powered by blists - more mailing lists