Re: [PATCH 2/4] mm: move per-vma lock into vm_area_struct

From: Suren Baghdasaryan
Date: Tue Nov 12 2024 - 11:12:49 EST


On Tue, Nov 12, 2024 at 7:57 AM Vlastimil Babka <vbabka@xxxxxxx> wrote:
>
> On 11/11/24 21:55, Suren Baghdasaryan wrote:
> > @@ -511,7 +476,6 @@ void __vm_area_free(struct vm_area_struct *vma)
> > {
> > vma_numab_state_free(vma);
> > free_anon_vma_name(vma);
> > - vma_lock_free(vma);
> > kmem_cache_free(vm_area_cachep, vma);
> > }
>
> Have you investigated if this allows to perform vma_numab_state_free() and
> free_anon_vma_name() immediately, and only kfree_rcu() the vma itself,
> instead of performing all this in a call_rcu() callback?

Yes, it should be fine to free them immediately. lock_vma_under_rcu()
does not use neither vma->numab_state, nor vma->anon_name.

>
> Of course if we succeed converting vma's to SLAB_TYPESAFE_RCU this immediate
> freeing of numab state and anon_vma_name would be implied, but maybe it's an
> useful intermediate step on its own.

I'm thinking maybe I should post SLAB_TYPESAFE_RCU conversion before
anything else. It's simple and quite uncontroversial. I will probably
do that today.