From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Pedro Falcato <pedro.falcato@gmail.com>
Cc: 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>,
Jeff Xu <jeffxu@chromium.org>
Subject: Re: [PATCH v2 1/2] mm/mremap: Clean up vma_to_resize()
Date: Tue, 22 Oct 2024 22:10:19 -0400 [thread overview]
Message-ID: <k6s5l5ux44ioh7wwv5wqjiieufb7b67dmphxyrhbxqvxemlohx@rldpvyh4r5a5> (raw)
In-Reply-To: <CAKbZUD3YLqWOyN7t8d9x3drJBJFSQw0O9dq7reY2p-gQ-wen5Q@mail.gmail.com>
* Pedro Falcato <pedro.falcato@gmail.com> [241022 18:08]:
> On Fri, Oct 18, 2024 at 6:41 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 resize_is_valid() to better reflect what it is doing.
>
> Small nit: Could we pick a stable naming scheme?
> I understand the kernel has historically had plenty of ways to name
> functions, including
> do_stuff
> is_stuff
> stuff_do
> stuff_is
>
> I thought we were starting to converge into vma_/vmi_/vms_ :(
> I would personally prefer vma_resize_is_valid/vma_resize_valid (even
> if it's a static function, so it doesn't matter _too_ much).
> Anyway, enough bikeshedding...
Right. Usually the vma_/vmi_/vms_ stuff indicates the first argument to
the functions exposed to other files. Yes, vma_ would work here, and I
don't really mind that it's static and has the vma_ name.
I'd suggest relocating it to vma.c or vma.h, but then we'd have to put
mremap in the name and that would be rather long - I don't think we do
anything like this elsewhere.
>
> >
> > This commit also adds documentation about the function.
> >
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
>
> Reviewed-by: Pedro Falcato <pedro.falcato@gmail.com>
Thanks!
>
> This patch made me realize there's a couple of small improvements we
> can still do (maybe with a vmi) to clean up and speed up mremap (at
> least!). I'll look into those if I find some time.
Agreed. If you do get to doing more clean up, I'd be fine with a rename
of this function.
Regards,
Liam
next prev parent reply other threads:[~2024-10-23 2:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 17:41 [PATCH v2 0/2] mm/mremap: Remove extra vma tree walk Liam R. Howlett
2024-10-18 17:41 ` [PATCH v2 1/2] mm/mremap: Clean up vma_to_resize() Liam R. Howlett
2024-10-21 10:03 ` Lorenzo Stoakes
2024-10-22 22:08 ` Pedro Falcato
2024-10-23 2:10 ` Liam R. Howlett [this message]
2024-10-18 17:41 ` [PATCH v2 2/2] mm/mremap: Remove goto from mremap_to() Liam R. Howlett
2024-10-21 10:19 ` Lorenzo Stoakes
2024-10-22 22:10 ` Pedro Falcato
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=k6s5l5ux44ioh7wwv5wqjiieufb7b67dmphxyrhbxqvxemlohx@rldpvyh4r5a5 \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=jannh@google.com \
--cc=jeffxu@chromium.org \
--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