Re: [PATCH v3 3/5] mm: Add RCU-based VMA lookup helper that waits for writers

From: Lorenzo Stoakes (ARM)

Date: Tue Aug 04 2026 - 04:53:58 EST


On Tue, Aug 04, 2026 at 09:59:26AM +0200, Vlastimil Babka (SUSE) wrote:
> On 8/3/26 21:13, Suren Baghdasaryan wrote:
> > On Mon, Aug 3, 2026 at 9:44 AM Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx> wrote:
> >> Agree this is worth spelling out in the comment (I raised similarly).
> >>
> >> Maybe something like:
> >>
> >> If a VMA exists which spans @address, return that VMA, read-locked.
> >>
> >> If no VMA is mapped there or, very unlikely, a reference count overflow
> >> occurred, return NULL.
> >>
> >> Nothing prevents VMAs being unmapped/mapped before or after the VMA is
> >> looked up, if a stronger guarantee is required, take an mmap lock.
> >
> > This last statement is true only if the function returns NULL, so I
> > think it should be in the same paragraph as the "If no VMA is
> > mapped..." sentence and prepended with "In this case...". So:
> >
> > If no VMA is mapped there or, very unlikely, a reference count overflow
> > occurred, return NULL. In this case, nothing prevents VMAs
> > being unmapped/
> > mapped before or after the VMA is looked up, if a stronger guarantee is
> > required, take an mmap lock.
> >
> > Does that sounds good?
>
> Yeah, thanks both!

Agreed thanks!

>
>

--
Cheers, Lorenzo