[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <k6s5l5ux44ioh7wwv5wqjiieufb7b67dmphxyrhbxqvxemlohx@rldpvyh4r5a5>
Date: Tue, 22 Oct 2024 22:10:19 -0400
From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
To: Pedro Falcato <pedro.falcato@...il.com>
Cc: 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>,
Jeff Xu <jeffxu@...omium.org>
Subject: Re: [PATCH v2 1/2] mm/mremap: Clean up vma_to_resize()
* Pedro Falcato <pedro.falcato@...il.com> [241022 18:08]:
> On Fri, Oct 18, 2024 at 6:41 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 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@...cle.com>
>
> Reviewed-by: Pedro Falcato <pedro.falcato@...il.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
Powered by blists - more mailing lists