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

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

 



* Jeff Xu <jeffxu@xxxxxxxxxxxx> [241017 13:55]:
> On Wed, Oct 16, 2024 at 1:17 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 mremap_vma_check() to better reflect what it is doing.
> >
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
> > ---
> >  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.

...

Thanks,
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