|
|
Log in / Subscribe / Register

use vma locks for proc/pid/{smaps|numa_maps} reads

From:  Suren Baghdasaryan <surenb-AT-google.com>
To:  akpm-AT-linux-foundation.org
Subject:  [PATCH 0/3] use vma locks for proc/pid/{smaps|numa_maps} reads
Date:  Fri, 24 Apr 2026 00:02:31 -0700
Message-ID:  <20260424070234.190145-1-surenb@google.com>
Cc:  liam-AT-infradead.org, ljs-AT-kernel.org, vbabka-AT-kernel.org, david-AT-redhat.com, willy-AT-infradead.org, jannh-AT-google.com, paulmck-AT-kernel.org, pfalcato-AT-suse.de, shuah-AT-kernel.org, hsukrut3-AT-gmail.com, richard.weiyang-AT-gmail.com, reddybalavignesh9979-AT-gmail.com, linux-mm-AT-kvack.org, linux-kernel-AT-vger.kernel.org, linux-fsdevel-AT-vger.kernel.org, linux-kselftest-AT-vger.kernel.org, surenb-AT-google.com
Archive-link:  Article

Use per-vma locks when reading /proc/pid/smaps and /proc/pid/numa_maps
similar to /proc/pid/maps to reduce contention on central mmap_lock. One
major difference between maps and smaps/numa_maps reading is that the
latter executes page table walk which can't be done under RCU due to a
possibility of sleeping. Therefore we drop RCU read lock before this walk
while keeping the VMA locked. After the walk we retake RCU read lock,
reset VMA iterator and proceed with the next VMA.

The last two patches extend /proc/pid/maps test to cover /proc/pid/smaps
reading during concurrent address space modification.

Applies over mm-unstable.

Suren Baghdasaryan (3):
  fs/proc/task_mmu: read proc/pid/{smaps|numa_maps} under per-vma lock
  selftests/proc: ensure the test is performed at the right page
    boundary
  selftests/proc: add /proc/pid/smaps tearing tests

 fs/proc/task_mmu.c                            | 193 ++++++++++---
 tools/testing/selftests/proc/proc-maps-race.c | 254 ++++++++++++++----
 2 files changed, 354 insertions(+), 93 deletions(-)


base-commit: a22b29c0b1a2a245ef5f782d7456de3c76eb135f
-- 
2.54.0.545.g6539524ca2-goog




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds