mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] selftests/proc: use RSS in /proc/pid/smaps_rollup tearing tests
@ 2026-10-28  5:13 Suren Baghdasaryan
  2026-10-28  9:19 ` Lorenzo Stoakes (ARM)
  2026-10-28 10:14 ` Pedro Falcato
  0 siblings, 2 replies; 3+ messages in thread
From: Suren Baghdasaryan @ 2026-10-28  5:13 UTC (permalink / raw)
  To: akpm
  Cc: david, ljs, jannh, liam, willy, paulmck, pfalcato, usama.arif,
	vbabka, linux-fsdevel, yi1.lai, oe-lkp, lkp, linux-kernel,
	Suren Baghdasaryan

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@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202610271934.fd287c3f-lkp@intel.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] selftests/proc: use RSS in /proc/pid/smaps_rollup tearing tests
  2026-10-28  5:13 [PATCH 1/1] selftests/proc: use RSS in /proc/pid/smaps_rollup tearing tests Suren Baghdasaryan
@ 2026-10-28  9:19 ` Lorenzo Stoakes (ARM)
  2026-10-28 10:14 ` Pedro Falcato
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-10-28  9:19 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: akpm, david, jannh, liam, willy, paulmck, pfalcato, usama.arif,
	vbabka, linux-fsdevel, yi1.lai, oe-lkp, lkp, linux-kernel

On Tue, Oct 27, 2026 at 10:13:12PM -0700, Suren Baghdasaryan wrote:
> 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@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202610271934.fd287c3f-lkp@intel.com
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>

Seems sensible, I gather in general PSS is a less than ideal measure in these
stats anyway :)

Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>

> ---
>  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
>

--
Cheers, Lorenzo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] selftests/proc: use RSS in /proc/pid/smaps_rollup tearing tests
  2026-10-28  5:13 [PATCH 1/1] selftests/proc: use RSS in /proc/pid/smaps_rollup tearing tests Suren Baghdasaryan
  2026-10-28  9:19 ` Lorenzo Stoakes (ARM)
@ 2026-10-28 10:14 ` Pedro Falcato
  1 sibling, 0 replies; 3+ messages in thread
From: Pedro Falcato @ 2026-10-28 10:14 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: akpm, david, ljs, jannh, liam, willy, paulmck, usama.arif,
	vbabka, linux-fsdevel, yi1.lai, oe-lkp, lkp, linux-kernel

On Tue, Oct 27, 2026 at 10:13:12PM -0700, Suren Baghdasaryan wrote:
> 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@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202610271934.fd287c3f-lkp@intel.com
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>

Reviewed-by: Pedro Falcato <pfalcato@suse.de> 

-- 
Pedro

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-28 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28  5:13 [PATCH 1/1] selftests/proc: use RSS in /proc/pid/smaps_rollup tearing tests Suren Baghdasaryan
2026-10-28  9:19 ` Lorenzo Stoakes (ARM)
2026-10-28 10:14 ` Pedro Falcato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®