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

From: Suren Baghdasaryan
Date: Thu Dec 19 2024 - 11:09:17 EST


On Thu, Dec 19, 2024 at 12:55 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> 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.

Ok, I'll stop considering this option.