Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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

Link: https://lkml.kernel.org/r/20210825135843.29052-1-george_davis@mentor.com
Fixes: 0085d61fe05e ("selftests/vm/transhuge-stress: stress test for memory compaction")
Signed-off-by: George G. Davis <davis.george@siemens.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

George G. Davis and committed by
Linus Torvalds
39cad887 20f9ba4f

+1 -1
+1 -1
tools/testing/selftests/vm/transhuge-stress.c
··· 79 79 80 80 warnx("allocate %zd transhuge pages, using %zd MiB virtual memory" 81 81 " and %zd MiB of ram", len >> HPAGE_SHIFT, len >> 20, 82 - len >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1)); 82 + ram >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1)); 83 83 84 84 pagemap_fd = open("/proc/self/pagemap", O_RDONLY); 85 85 if (pagemap_fd < 0)