Skip to contentSkip to conversation

selftests/vm/transhuge-stress: fix ram size thinko

RFC PATCH Applied George G. Davis 3 participants 4 messages Aug 25, 2021 – Oct 15, 2021 Kselftest

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 selftests/vm/transhuge-stress: fix ram size thinko

From: "George G. Davis" <[email protected]>

When executing transhuge-stress with an argument to specify the virtual memory size for testing, the ram size is reported as 0, e.g.

transhuge-stress 384
thp-mmap: allocate 192 transhuge pages, using 384 MiB virtual memory and 0 MiB of ram
thp-mmap: 0.184 s/loop, 0.957 ms/page, 2090.265 MiB/s 192 succeed, 0 failed

This appears to be due to a thinko in commit 0085d61fe05e ("selftests/vm/transhuge-stress: stress test for memory compaction"), where, at a guess, the intent was to base "xyz MiB of ram" on ram size. Here are results after using ram size:

thp-mmap: allocate 192 transhuge pages, using 384 MiB virtual memory and 14 MiB of ram

Fixes 0085d61fe05e ("selftests/vm/transhuge-stress: stress test for memory compaction")
---
 tools/testing/selftests/vm/transhuge-stress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vm/transhuge-stress.c +1 -1
index fd7f1b4a96f9..5e4c036f6ad3 100644
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
 
 	warnx("allocate %zd transhuge pages, using %zd MiB virtual memory"
 	      " and %zd MiB of ram", len >> HPAGE_SHIFT, len >> 20,
-	      len >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1));
+	      ram >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1));
 
 	pagemap_fd = open("/proc/self/pagemap", O_RDONLY);
 	if (pagemap_fd < 0)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 27 lines · George G. Davis

From: "George G. Davis" <[email protected]>

When executing transhuge-stress with an argument to specify the virtual memory size for testing, the ram size is reported as 0, e.g.

transhuge-stress 384
thp-mmap: allocate 192 transhuge pages, using 384 MiB virtual memory and 0 MiB of ram
thp-mmap: 0.184 s/loop, 0.957 ms/page, 2090.265 MiB/s 192 succeed, 0 failed

This appears to be due to a thinko in commit 0085d61fe05e ("selftests/vm/transhuge-stress: stress test for memory compaction"), where, at a guess, the intent was to base "xyz MiB of ram" on ram size. Here are results after using ram size:

thp-mmap: allocate 192 transhuge pages, using 384 MiB virtual memory and 14 MiB of ram

Fixes 0085d61fe05e ("selftests/vm/transhuge-stress: stress test for memory compaction")
---
 tools/testing/selftests/vm/transhuge-stress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vm/transhuge-stress.c +0 -0
index fd7f1b4a96f9..5e4c036f6ad3 100644

tools/testing/selftests/vm/transhuge-stress.c int main(int argc, char **argv) · line 82

Quoted 5 lines
tools/testing/selftests/vm/transhuge-stress.c +1 -1
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
 
 	warnx("allocate %zd transhuge pages, using %zd MiB virtual memory"
 	      " and %zd MiB of ram", len >> HPAGE_SHIFT, len >> 20,
-	      len >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1));
+	      ram >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1));

Ping, any comments on this?

For the record, as noted, the value reported for "ram size" appears to use the wrong variable, len, where ram should be used instead.

Quoted 6 lines
tools/testing/selftests/vm/transhuge-stress.c +0 -0
 	pagemap_fd = open("/proc/self/pagemap", O_RDONLY);
 	if (pagemap_fd < 0)
Signature · 1 line
2.17.1
Signature · 2 lines
Regards,
George
maintainer
#2 lore raw
In reply to George G. Davis
Quoted 28 lines · George G. Davis

From: "George G. Davis" <[email protected]>

When executing transhuge-stress with an argument to specify the virtual memory size for testing, the ram size is reported as 0, e.g.

transhuge-stress 384
thp-mmap: allocate 192 transhuge pages, using 384 MiB virtual memory and 0 MiB of ram
thp-mmap: 0.184 s/loop, 0.957 ms/page, 2090.265 MiB/s 192 succeed, 0 failed

This appears to be due to a thinko in commit 0085d61fe05e ("selftests/vm/transhuge-stress: stress test for memory compaction"), where, at a guess, the intent was to base "xyz MiB of ram" on ram size. Here are results after using ram size:

thp-mmap: allocate 192 transhuge pages, using 384 MiB virtual memory and 14 MiB of ram

Fixes 0085d61fe05e ("selftests/vm/transhuge-stress: stress test for memory compaction")
---
  tools/testing/selftests/vm/transhuge-stress.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vm/transhuge-stress.c +0 -0
index fd7f1b4a96f9..5e4c036f6ad3 100644

tools/testing/selftests/vm/transhuge-stress.c int main(int argc, char **argv) · line 85

Quoted 8 lines
tools/testing/selftests/vm/transhuge-stress.c +1 -1
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
 
  	warnx("allocate %zd transhuge pages, using %zd MiB virtual memory"
  	      " and %zd MiB of ram", len >> HPAGE_SHIFT, len >> 20,
-	      len >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1));
+	      ram >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1));
 
  	pagemap_fd = open("/proc/self/pagemap", O_RDONLY);
  	if (pagemap_fd < 0)

Sorry for the delay on this. The change looks good to me.

Andrew! Would you like me to take this through kselftest tree?

thanks,
-- Shuah

#3 lore raw
Quoted 34 lines · On Fri, 15 Oct 2021 09:38:24 -0600 Shuah Khan <[email protected]> wrote:
Quoted 33 lines · George G. Davis

From: "George G. Davis" <[email protected]>

When executing transhuge-stress with an argument to specify the virtual memory size for testing, the ram size is reported as 0, e.g.

transhuge-stress 384
thp-mmap: allocate 192 transhuge pages, using 384 MiB virtual memory and 0 MiB of ram
thp-mmap: 0.184 s/loop, 0.957 ms/page, 2090.265 MiB/s 192 succeed, 0 failed

This appears to be due to a thinko in commit 0085d61fe05e ("selftests/vm/transhuge-stress: stress test for memory compaction"), where, at a guess, the intent was to base "xyz MiB of ram" on ram size. Here are results after using ram size:

thp-mmap: allocate 192 transhuge pages, using 384 MiB virtual memory and 14 MiB of ram

Fixes 0085d61fe05e ("selftests/vm/transhuge-stress: stress test for memory compaction")
---
  tools/testing/selftests/vm/transhuge-stress.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vm/transhuge-stress.c +1 -1
index fd7f1b4a96f9..5e4c036f6ad3 100644
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
 
  	warnx("allocate %zd transhuge pages, using %zd MiB virtual memory"
  	      " and %zd MiB of ram", len >> HPAGE_SHIFT, len >> 20,
-	      len >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1));
+	      ram >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1));
 
Quoted 5 lines

tools/testing/selftests/vm/transhuge-stress.c int main(int argc, char **argv) · line 85

Quoted 3 lines
tools/testing/selftests/vm/transhuge-stress.c +0 -0
  	pagemap_fd = open("/proc/self/pagemap", O_RDONLY);
  	if (pagemap_fd < 0)

Sorry for the delay on this. The change looks good to me.

Konstantin, coould you please take a look?

Quoted 1 line

Andrew! Would you like me to take this through kselftest tree?

Is OK thanks - I'll add it to my mm/thp pile.