Re: [PATCH 19/21] mm/hugetlb: use the VMA lock to stabilize flags for PMD sharing
From: Suren Baghdasaryan
Date: Tue Dec 01 2026 - 16:01:28 EST
On Tue, Dec 1, 2026 at 12:24 PM David Hildenbrand (Arm)
<david@xxxxxxxxxx> wrote:
>
> Hi,
>
> thanks for the review!
>
> >
> > Right, it does not block on contention, it is designed to be used in a
> > fastpath with a fallback that would block.
>
> Right ... which is similar to what the hugetlb scenario wants. trylock, if it
> fails give up.
>
> Just like giving up when trylocking the mmap lock fails.
>
> >
> >>
> >> Right now lock_vma_under_rcu() is the way (TM) to get a VMA lock without an
> >> mmap lock already held. For now I'd like to maintain it as that.
> >
> > Completely agree.
> > This patch does not introduce a new trylock functionality. It just
> > exposes an internal function, namely vma_start_read() to the outside
> > world.
>
> I disagree. It exposes a reasonable function for a reasonable use case: try
> grabbing the VMA lock while it is guaranteed to not go away (munmap etc
> impossible). Just like trylocking the mmap lock.
Ok, you have a point. However, the way it's implemented here isn't
what I would call robust.
>
> BUT I agree that making this available to other users that might just abuse it
> is not good, and the use case is likely not important enough to optimize for
> this at this point.
>
> I'm sure we'll hear about this again if it affects real workloads and I'll let
> all of you figure out a better solution then :P
Perhaps knowing how the VMA is guaranteed to remain alive in a
specific case would reveal a better API.
>
> Thanks!
>
> --
> Cheers,
>
> David