Re: [PATCH v2 1/3] mm: vmalloc: Avoid of calling __find_vmap_area() twise in __vunmap()

From: Uladzislau Rezki
Date: Thu Dec 22 2022 - 09:43:53 EST


On Thu, Dec 22, 2022 at 07:38:14PM +0800, Baoquan He wrote:
> On 12/21/22 at 06:44pm, Uladzislau Rezki (Sony) wrote:
> > Currently __vunmap() path calls __find_vmap_area() two times. One on
> > entry to check that area exists, second time inside remove_vm_area()
> > function that also performs a new search of VA.
> >
> > In order to improvie it from a performance point of view we split
> > remove_vm_area() into two new parts:
> > - find_unlink_vmap_area() that does a search and unlink from tree;
> > - __remove_vm_area() that does a removing but without searching.
> >
> > In this case there is no any functional change for remove_vm_area()
> > whereas vm_remove_mappings(), where a second search happens, switches
> > to the __remove_vm_area() variant where already detached VA is passed
> > as a parameter, so there is no need to find it again.
>
> I like this patch. This takes off the va->vm clearning too. Finally I
> don't need to worry about the va->flags clearing during unmapping
> when reading out vmap_block areas.
>
Thanks. This patch was one of the reason to help out with the per-cpu
busy areas tracking/reading of your work :)

--
Uladzsislau Rezki