Re: [PATCH v6 10/16] mm: replace vm_lock and detached flag with a reference count

Peter Zijlstra
2024-12-19T08:55:30Z

On Wed, Dec 18, 2024 at 11:29:23AM -0800, Suren Baghdasaryan wrote:

> Yeah, I think we can simply do this:
>
> vms_complete_munmap_vmas
> vms_clear_ptes
> remove_vma
> vma_mark_detached
> mmap_write_downgrade
>
> If my assumption is incorrect, assertion inside vma_mark_detached()
> should trigger. I tried a quick test and so far nothing exploded.

I think that would be unfortunate and could cause regressions. I think
we want to keep vms_clear_ptes() under the read-lock.