Re: [PATCH v2 1/2] mm/mremap: Clean up vma_to_resize()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Pedro Falcato <pedro.falcato@xxxxxxxxx> [241022 18:08]:
> On Fri, Oct 18, 2024 at 6:41 PM Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> wrote:
> >
> > From: "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>
> >
> > 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@xxxxxxxxxx>
> 
> Reviewed-by: Pedro Falcato <pedro.falcato@xxxxxxxxx>

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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux