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

From: Dave Hansen

Date: Thu Jun 11 2026 - 17:07:09 EST


On 6/11/26 13:35, Suren Baghdasaryan wrote:
>> + /* Slow path: preclude VMA writers by getting mmap read lock. */
>> + guard(rwsem_read)(&mm->mmap_lock);
> guard() is nice but mmap_read_{lock|unlock} has those
> __mmap_lock_trace_* traces which we lose with guard(). Not sure if
> that's a good enough reason to keep using older primitives.

I stole the guard() from Lorenzo's suggestion. I'm totally fine doing it
whichever way you two would prefer.

I'm old school but I personally find guard() harder to read. I tend to
only use it where it is *vastly* superior to explicit lock/unlock. But,
seriously, I'm open to whatever folks want.