| From: |
| Kalesh Singh <kaleshsingh-AT-google.com> |
| To: |
| akpm-AT-linux-foundation.org, minchan-AT-kernel.org, lorenzo.stoakes-AT-oracle.com, david-AT-redhat.com, Liam.Howlett-AT-oracle.com, rppt-AT-kernel.org, pfalcato-AT-suse.de |
| Subject: |
| [PATCH v2 0/7] vma count: fixes, test and improvements |
| Date: |
| Mon, 15 Sep 2025 09:36:31 -0700 |
| Message-ID: |
| <20250915163838.631445-1-kaleshsingh@google.com> |
| Cc: |
| kernel-team-AT-android.com, android-mm-AT-google.com, Kalesh Singh <kaleshsingh-AT-google.com>, Alexander Viro <viro-AT-zeniv.linux.org.uk>, Christian Brauner <brauner-AT-kernel.org>, Jan Kara <jack-AT-suse.cz>, Kees Cook <kees-AT-kernel.org>, Vlastimil Babka <vbabka-AT-suse.cz>, Suren Baghdasaryan <surenb-AT-google.com>, Michal Hocko <mhocko-AT-suse.com>, Steven Rostedt <rostedt-AT-goodmis.org>, Masami Hiramatsu <mhiramat-AT-kernel.org>, Mathieu Desnoyers <mathieu.desnoyers-AT-efficios.com>, Ingo Molnar <mingo-AT-redhat.com>, Peter Zijlstra <peterz-AT-infradead.org>, Juri Lelli <juri.lelli-AT-redhat.com>, Vincent Guittot <vincent.guittot-AT-linaro.org>, Dietmar Eggemann <dietmar.eggemann-AT-arm.com>, Ben Segall <bsegall-AT-google.com>, Mel Gorman <mgorman-AT-suse.de>, Valentin Schneider <vschneid-AT-redhat.com>, Jann Horn <jannh-AT-google.com>, Shuah Khan <shuah-AT-kernel.org>, linux-kernel-AT-vger.kernel.org, linux-fsdevel-AT-vger.kernel.org, linux-mm-AT-kvack.org, linux-trace-kernel-AT-vger.kernel.org, linux-kselftest-AT-vger.kernel.org |
| Archive-link: |
| Article |
Hi all,
This is v2 to the VMA count patch I previously posted at:
https://lore.kernel.org/r/20250903232437.1454293-1-kalesh...
I've split it into multiple patches to address the feedback.
The main changes in v2 are:
- Use a capacity-based check for VMA count limit, per Lorenzo.
- Rename map_count to vma_count, per David.
- Add assertions for exceeding the limit, per Pedro.
- Add tests for max_vma_count, per Liam.
- Emit a trace event for failure due to insufficient capacity for
observability
Tested on x86_64 and arm64:
- Build test:
- allyesconfig for rename
- Selftests:
cd tools/testing/selftests/mm && \
make && \
./run_vmtests.sh -t max_vma_count
(With trace_max_vma_count_exceeded enabled)
- vma tests:
cd tools/testing/vma && \
make && \
./vma
Thanks,
Kalesh
Kalesh Singh (7):
mm: fix off-by-one error in VMA count limit checks
mm/selftests: add max_vma_count tests
mm: introduce vma_count_remaining()
mm: rename mm_struct::map_count to vma_count
mm: harden vma_count against direct modification
mm: add assertion for VMA count limit
mm/tracing: introduce max_vma_count_exceeded trace event
fs/binfmt_elf.c | 2 +-
fs/coredump.c | 2 +-
include/linux/mm.h | 35 +-
include/linux/mm_types.h | 5 +-
include/trace/events/vma.h | 32 +
kernel/fork.c | 2 +-
mm/debug.c | 2 +-
mm/internal.h | 1 +
mm/mmap.c | 28 +-
mm/mremap.c | 13 +-
mm/nommu.c | 8 +-
mm/util.c | 1 -
mm/vma.c | 88 ++-
tools/testing/selftests/mm/Makefile | 1 +
.../selftests/mm/max_vma_count_tests.c | 709 ++++++++++++++++++
tools/testing/selftests/mm/run_vmtests.sh | 5 +
tools/testing/vma/vma.c | 32 +-
tools/testing/vma/vma_internal.h | 44 +-
18 files changed, 949 insertions(+), 61 deletions(-)
create mode 100644 include/trace/events/vma.h
create mode 100644 tools/testing/selftests/mm/max_vma_count_tests.c
base-commit: f83ec76bf285bea5727f478a68b894f5543ca76e
--
2.51.0.384.g4c02a37b29-goog