[PATCH v5 0/7] read proc/pid/smaps_rollup under per-vma lock

Suren Baghdasaryan posted 7 patches 6 days, 7 hours ago
fs/proc/task_mmu.c                            | 341 ++++++++----------
tools/testing/selftests/proc/proc-maps-race.c | 186 +++++++++-
2 files changed, 336 insertions(+), 191 deletions(-)
[PATCH v5 0/7] read proc/pid/smaps_rollup under per-vma lock
Posted by Suren Baghdasaryan 6 days, 7 hours ago
proc/pid/smaps_rollup can be read using the combination of RCU and
VMA read locks, similar to proc/pid/{maps|smaps|numa_maps}. RCU is
required to safely traverse the VMA tree and VMA lock stabilizes the
VMA being processed and the pagetable walk.
Note that we have to keep the logic to drop mmap_lock on contention
because even when using per-VMA locks we might have to fall back to
holding the mmap_lock.

The first 5 patches are cleanups making later change simpler. The main
change is in patch 6. Patch 7 extends existing proc-maps-race tearing
test to verify smaps_rollup content.

Changes since v4 [1]:
Patch 2:
- Fixed warnings with CONFIG_PROC_PAGE_MONITOR=n
- Fixed a typo in the changelog
Patch 3:
- Add Reviewed-by and Acked-by, per Lorenzo Stoakes and
  David Hildenbrand
Patch 3:
- Add Reviewed-by and Acked-by, per Lorenzo Stoakes and
  David Hildenbrand

[1] https://lore.kernel.org/all/20260911194145.1781926-1-surenb@google.com/

Suren Baghdasaryan (7):
  proc/task_mmu: remove unnecessary helpers
  proc/task_mmu: remove unnecessary inlines in function definitions
  proc/task_mmu: clarify shmem mapping walk conditions in
    smap_gather_stats()
  proc/task_mmu: remove special-casing of smap_gather_stats() start
    parameter
  proc/task_mmu: change proc_get_vma() to stop returning gate VMA at the
    end
  proc/task_mmu: read proc/pid/smaps_rollup under per-vma lock
  selftests/proc: add /proc/pid/smaps_rollup tearing tests

 fs/proc/task_mmu.c                            | 341 ++++++++----------
 tools/testing/selftests/proc/proc-maps-race.c | 186 +++++++++-
 2 files changed, 336 insertions(+), 191 deletions(-)


base-commit: 854157fc9d011b8dd5a1a86a237447e28d681eb9
-- 
2.55.0.1082.g2b9226bbc0-goog
Re: [PATCH v5 0/7] read proc/pid/smaps_rollup under per-vma lock
Posted by Andrew Morton 6 days, 7 hours ago
On Fri, 18 Sep 2026 08:33:11 -0700 Suren Baghdasaryan <surenb@google.com> wrote:

> proc/pid/smaps_rollup can be read using the combination of RCU and
> VMA read locks, similar to proc/pid/{maps|smaps|numa_maps}. RCU is
> required to safely traverse the VMA tree and VMA lock stabilizes the
> VMA being processed and the pagetable walk.
> Note that we have to keep the logic to drop mmap_lock on contention
> because even when using per-VMA locks we might have to fall back to
> holding the mmap_lock.
> 
> The first 5 patches are cleanups making later change simpler. The main
> change is in patch 6. Patch 7 extends existing proc-maps-race tearing
> test to verify smaps_rollup content.

Thanks, I added this to mm.git's mm-new branch.