[PATCH 1/1] selftests/proc: use RSS in /proc/pid/smaps_rollup tearing tests
From: Suren Baghdasaryan
Date: Wed Oct 28 2026 - 01:14:49 EST
Pss metrics can be affected by map count even if VMA tree stays unchanged,
therefore test checking VMA tree integrity can't use them. Use Rss instead
and pre-populate the VMAs so that Rss changes if a VMA gets skipped or
double-counted.
Fixes: ca5480fb53fa ("selftests/proc: add /proc/pid/smaps_rollup tearing tests")
Reported-by: kernel test robot <yi1.lai@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-lkp/202610271934.fd287c3f-lkp@xxxxxxxxx
Signed-off-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
---
tools/testing/selftests/proc/proc-maps-race.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/proc/proc-maps-race.c b/tools/testing/selftests/proc/proc-maps-race.c
index bf4c5073f6fc..b6d88afb252b 100644
--- a/tools/testing/selftests/proc/proc-maps-race.c
+++ b/tools/testing/selftests/proc/proc-maps-race.c
@@ -528,13 +528,10 @@ static bool compare_smaps_rollup(FIXTURE_DATA(proc_maps_race) *self,
struct smaps_rollup_stats *actual)
{
/*
- * Clean/dirty metrics might change but Pss-related ones
- * should stay constant.
+ * Clean/dirty metrics might change. Pss depends on map count and might
+ * change as well. Rss should stay constant.
*/
- if (cmp_smaps_rollup_stat(expected, actual, Pss) &&
- cmp_smaps_rollup_stat(expected, actual, Pss_Anon) &&
- cmp_smaps_rollup_stat(expected, actual, Pss_File) &&
- cmp_smaps_rollup_stat(expected, actual, Pss_Shmem))
+ if (cmp_smaps_rollup_stat(expected, actual, Rss))
return true;
print_smaps_rollup_stats("Expected stats:", self, expected);
@@ -759,7 +756,7 @@ FIXTURE_SETUP(proc_maps_race)
for (i = 0; i < mod_info->vma_count; i++) {
mod_info->child_mapped_addr[i] = mmap(NULL, self->page_size * 3, prot,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
ASSERT_NE(mod_info->child_mapped_addr[i], MAP_FAILED);
/* change protection in adjacent maps to prevent merging */
prot ^= PROT_WRITE;
base-commit: 39274b454e9993cea319f4ac342a8082a9ee1730
--
2.56.0.307.g5fe7bd680c-goog