mm: test_vmstat: add synthetic benchmark for vm stats
Subsystems (2)
PATCH v3 1/1 mm: test_vmstat: add synthetic benchmark for vm stats
From: Christoph Lameter <[email protected]>
Add a synthetic benchmark that can be used to measure performance of VM statistics. This is used to analyze any improvements or regressions in functions that are frequently used in hot code paths.
The test is run by KUnit or doing modprobe vmstat_kunit directly.
---
v3:
- switch to KUnit per David
MAINTAINERS | 1 + mm/Kconfig | 11 +++ mm/Makefile | 1 + mm/tests/vmstat_kunit.c | 160 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 mm/tests/vmstat_kunit.c
MAINTAINERS +1 -0
@@ -17161,6 +17161,7 @@ F: mm/ptdump.c F: mm/sparse-vmemmap.c F: mm/sparse.c F: mm/sparse.h +F: mm/tests/vmstat_kunit.c F: mm/util.c F: mm/vmpressure.c F: mm/vmstat.c
mm/Kconfig +11 -0
@@ -1511,6 +1511,17 @@ config LAZY_MMU_MODE_KUNIT_TEST If unsure, say N. +config VMSTAT_KUNIT_TEST + tristate "KUnit test for VM statistics" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + Enable this option to test and benchmark the performance of VM + statistics updates (zone page state and VM event counters), which + are used frequently in hot memory management code paths. + + If unsure, say N. + source "mm/damon/Kconfig" endmenu
mm/Makefile +1 -0
@@ -147,4 +147,5 @@ obj-$(CONFIG_SHRINKER_DEBUG) += shrinker_debug.o obj-$(CONFIG_EXECMEM) += execmem.o obj-$(CONFIG_TMPFS_QUOTA) += shmem_quota.o obj-$(CONFIG_LAZY_MMU_MODE_KUNIT_TEST) += tests/lazy_mmu_mode_kunit.o +obj-$(CONFIG_VMSTAT_KUNIT_TEST) += tests/vmstat_kunit.o obj-$(CONFIG_MEM_ALLOC_PROFILING) += alloc_tag.o
mm/tests/vmstat_kunit.c new file +160 -0
160 lines not on this page · raw message
Andrew Morton
maintainerQuoted 5 lines · On Fri, 11 Sep 2026 18:08:14 -0700 (PDT) David Rientjes <[email protected]>…
Add a synthetic benchmark that can be used to measure performance of VM statistics. This is used to analyze any improvements or regressions in functions that are frequently used in hot code paths.
The test is run by KUnit or doing modprobe
vmstat_kunitdirectly.
Can you please quote some typical kernel output in the changelog? That will help others to review the proposed change.
Sashiko made what appear to be some good points:
https://sashiko.dev/#/patchset/[email protected]
Quoted 9 lines · Andrew Morton
Quoted 5 lines
Add a synthetic benchmark that can be used to measure performance of VM statistics. This is used to analyze any improvements or regressions in functions that are frequently used in hot code paths.
The test is run by KUnit or doing modprobe
vmstat_kunitdirectly.Can you please quote some typical kernel output in the changelog? That will help others to review the proposed change.
Ack, will include the output in v4.
Quoted 3 lines
Sashiko made what appear to be some good points:
https://sashiko.dev/#/patchset/[email protected]
Got it, I'll use NR_MLOCK instead of SLABS_SCANNED since it's display only and won't have any side effects at runtime.
Instead of switching the type of the "rem" variable as suggested, we can just remove it entirely.