From: Jeff Xu <jeffxu@chromium.org>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
Jeff Xu <jeffxu@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Jann Horn <jannh@google.com>,
David Hildenbrand <david@redhat.com>,
Qi Zheng <zhengqi.arch@bytedance.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
Pedro Falcato <pedro.falcato@gmail.com>
Subject: Re: [PATCH 1/2] mm/mremap: Clean up vma_to_resize()
Date: Thu, 17 Oct 2024 11:15:20 -0700 [thread overview]
Message-ID: <CABi2SkW1Au3WZ6Qem=FppOFBGRn3GDJo5+U3yXpk2brK9MR8NQ@mail.gmail.com> (raw)
In-Reply-To: <4izjonpaqhkx6p3csfyxcjicgqahbmj2k6gupazehb3l7xhnvi@twlvpx2wc6ce>
On Thu, Oct 17, 2024 at 11:07 AM Liam R. Howlett
<Liam.Howlett@oracle.com> wrote:
>
> * Jeff Xu <jeffxu@chromium.org> [241017 13:55]:
> > On Wed, Oct 16, 2024 at 1:17 PM Liam R. Howlett <Liam.Howlett@oracle.com> wrote:
> > >
> > > From: "Liam R. Howlett" <Liam.Howlett@Oracle.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@Oracle.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
next prev parent reply other threads:[~2024-10-17 18:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 20:17 [PATCH 0/2] mm/mremap: Remove extra vma tree walk Liam R. Howlett
2024-10-16 20:17 ` [PATCH 1/2] mm/mremap: Clean up vma_to_resize() Liam R. Howlett
2024-10-17 17:55 ` Jeff Xu
2024-10-17 18:07 ` Liam R. Howlett
2024-10-17 18:15 ` Jeff Xu [this message]
2024-10-17 21:08 ` Andrew Morton
2024-10-17 23:53 ` Liam R. Howlett
2024-10-18 0:00 ` Andrew Morton
2024-10-16 20:17 ` [PATCH 2/2] mm/mremap: Remove goto from mremap_to() Liam R. Howlett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABi2SkW1Au3WZ6Qem=FppOFBGRn3GDJo5+U3yXpk2brK9MR8NQ@mail.gmail.com' \
--to=jeffxu@chromium.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=pedro.falcato@gmail.com \
--cc=wangkefeng.wang@huawei.com \
--cc=zhengqi.arch@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox