From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A30019CC14 for ; Fri, 24 Apr 2026 07:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777014178; cv=none; b=sZt+1CbP71sEVgBpbDmA6TLadtuLJm+OZUx0bc/mJlCec+y4gXf1JDmBS6BzbUIxTaMt1Vfb0w5lRg5hljxxbUXqNhE2a0mV7RyU2/bHsakpHaj0HF9vHIF1CBrzyEuwojYU8D/+osuexPuSOnZR6ocNEyeRou0xw8GgwjSkjHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777014178; c=relaxed/simple; bh=YCWTzN/i7ucHlXNg2mLVBc9k/4QhjPMBsOtk4DkUkqg=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=CuHrEGYAn8+4UDluTKTPwE2m87hby+4GSuPFrbiazZEYo9uvk/knA2V61812qOyFxH9Clv+fAalXI6dP63p34qc/ArIoXaMWxKNmlAIOcSHwFegQBDzggO7QiIkon+zD4AjU8CQoxujk21Ue4VsVZg2duBXj19Hcn2pVv8VFSag= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=b5EhU345; arc=none smtp.client-ip=74.125.82.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="b5EhU345" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-12c8ccc7593so8291286c88.1 for ; Fri, 24 Apr 2026 00:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777014175; x=1777618975; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=zxJZiwOMWb+N8XiOQ98GcOFWZadlOkrX+lM5TYojf0g=; b=b5EhU345yPbj+6V4c5uT1CetY1x3cZsn9TWEPpFndI1gYirReesG9RFW+7Z5Gjj80m Y0lecuaKNAXB5rbp7A1mAhaGo5afuQbGqrDvz9BTOlBdRqRtnsiv3RWe29NDbqEKiS6v k7xW5/EW6WyE0KEAQyjVORWYa5zTPqscGY6at118HDAR52Hgm2BCLuM9VyznuaQ76oKl l+Hh89fCkch0N+BlMrdjr/JHgG5m2dV9EFc3XeOCWA+EKQqLcNiY2oL51TQxj8e5Wlg7 1h7o89XR319ZxQfVJWJs0sG2KeCX3i1JZXdWmQVnU1Y1SbxYKMc2I85XYzcXnW2GSImE cZsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777014175; x=1777618975; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=zxJZiwOMWb+N8XiOQ98GcOFWZadlOkrX+lM5TYojf0g=; b=CG9wAKXbJZcqzfK8uSTwMK4fMnlrMHbXlmOUcCUy0BKRzh7bkp+xsK86noeWCjFCXS LqwGZbhCgukxIdt0APMboOU7n88VRjekOeiVBhrY7FnTSTS6FbPNu8jBqxtRYYsxLnR9 LCFnHZ07jDnHEU/IOHTnjcRq5SiMlX+e8+eu0ca732R1pg8kJRMsjx+9z8PFUjb2hoL7 wEEjAKaFh6pV9fc/fKHKroHwZ2zSb6ZiFXU5VF53DT7lb6iKR1bkLooUQ9uvuiQcSRIj z3UhcSUeTSd1vHhNeLttut8vJSqpEulOXO+GXH4hKXE1T0uZGZi+pwnHeOdUjadzTFKZ buug== X-Forwarded-Encrypted: i=1; AFNElJ+UOpBxqQExdIpVu8wdYE0ywcT8xTlr4FNK1gw+KKU3lDrwrBNdt/pDsx05Y2nblijdCZIcl7TyI34rs/g=@vger.kernel.org X-Gm-Message-State: AOJu0YzdrZJvg4QiWAy/1E9A16xdzAta2Oesf4vadw515xdNizUSxgeG 4pFyAUzy805t54fuJM6ESvjDlC/n0CjrS4jU8FRKlf//G3yHku6ZvieWD7Sid1XmO4HVMUpxbKs oRR3shA== X-Received: from dlbcf6.prod.google.com ([2002:a05:7022:4586:b0:12d:b65b:1fb3]) (user=surenb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:6895:b0:12c:8e7f:1b30 with SMTP id a92af1059eb24-12c8e7f1ca8mr10233008c88.2.1777014174940; Fri, 24 Apr 2026 00:02:54 -0700 (PDT) Date: Fri, 24 Apr 2026 00:02:31 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.545.g6539524ca2-goog Message-ID: <20260424070234.190145-1-surenb@google.com> Subject: [PATCH 0/3] use vma locks for proc/pid/{smaps|numa_maps} reads From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: liam@infradead.org, ljs@kernel.org, vbabka@kernel.org, david@redhat.com, willy@infradead.org, jannh@google.com, paulmck@kernel.org, pfalcato@suse.de, shuah@kernel.org, hsukrut3@gmail.com, richard.weiyang@gmail.com, reddybalavignesh9979@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, surenb@google.com Content-Type: text/plain; charset="UTF-8" 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