Re: [PATCH v9 11/17] mm: replace vm_lock and detached flag with a reference count

Wei Yang
2025-01-13T02:38:00Z

On Fri, Jan 10, 2025 at 08:25:58PM -0800, Suren Baghdasaryan wrote:
> static inline void vma_end_read(struct vm_area_struct *vma) {}
>@@ -908,12 +948,8 @@ static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm)
> vma->vm_mm = mm;
> vma->vm_ops = &vma_dummy_vm_ops;
> INIT_LIST_HEAD(&vma->anon_vma_chain);
>-#ifdef CONFIG_PER_VMA_LOCK
>- /* vma is not locked, can't use vma_mark_detached() */
>- vma->detached = true;
>-#endif
> vma_numab_state_init(vma);
>- vma_lock_init(vma);
>+ vma_lock_init(vma, false);

vma_init(vma, mm)
memset(vma, 0, sizeof(*vma))
...
vma_lock_init(vma, false);

It looks the vm_refcnt must be reset.

BTW, I don't figure out why we want to skip the reset of vm_refcnt. Is this
related to SLAB_TYPESAFE_BY_RCU?

> }
>

--
Wei Yang
Help you, Help me