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

"Vlastimil Babka (SUSE)" <[email protected]> Tue, 4 Aug 2026 09:59:26 +0200
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm,gmane.linux.network
Message-ID <[email protected]>
On 8/3/26 21:13, Suren Baghdasaryan wrote:
> On Mon, Aug 3, 2026 at 9:44 AM Lorenzo Stoakes (ARM) <[email protected]> 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!