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

From: Dave Hansen

Date: Wed Jun 10 2026 - 19:43:16 EST


On 6/10/26 16:04, Dave Hansen wrote:
> + /* Slow path: preclude VMA writers by getting mmap read lock. */
> + guard(rwsem_read)(&mm->mmap_lock);
> + if (!vma_start_read_locked(vma))
> + return NULL;

Welp, I actually ran and tested this, but it's got a big bug. The slow
path is broken. It needs:

/* Slow path: preclude VMA writers by getting mmap read lock. */
guard(rwsem_read)(&mm->mmap_lock);
+ vma = vma_lookup(mm, address);
if (!vma_start_read_locked(vma))
return NULL;

Because VMA is NULL in slow path otherwise. So it'll definitely need a
v3 or a fixup before it goes anywhere.