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... > > This commit also adds documentation about the function. > > Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> Reviewed-by: Pedro Falcato <pedro.falcato@xxxxxxxxx> 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. -- Pedro