Re: [PATCH] mm/damon/vaddr: drop redundant mmap_read_lock from damon_va_three_regions

From: Cunlong Li

Date: Sun Jun 07 2026 - 23:32:58 EST


On Sun, Jun 07, 2026 at 10:36:44AM -0700, SeongJae Park wrote:
> Hello Cunlong,
>
> On Sun, 07 Jun 2026 21:48:52 +0800 Cunlong Li <shenxiaogll@xxxxxxxxx> wrote:
>
> > __damon_va_three_regions() already walks VMAs under rcu_read_lock(), so
> > the outer mmap_read_lock() is no longer needed.
>
> The function aims to read a snapshot of the virtual address space. So I think
> mmap_read_lock() is still required. Please let me know if I'm missing
> something.
>
>
> Thanks,
> SJ
>
> [...]

Yes — I understand this path is meant to obtain a snapshot of the VMA layout.

My thinking was that an exact snapshot may not be required here, and
the RCU-protected traversal inside __damon_va_three_regions() already
makes the walk safe, so the outer mmap_read_lock() might be redundant.

But, if we want a consistent VMA layout here, mmap_read_lock() is the
right mechanism and rcu_read_lock() alone is not enough. I'll drop
the patch :)

Thanks,
Cunlong