linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH] selftests/vm/transhuge-stress: fix ram size thinko
@ 2021-08-25 13:58 George G. Davis
  2021-09-28 17:58 ` George G. Davis
  2021-10-15 15:38 ` Shuah Khan
  0 siblings, 2 replies; 4+ messages in thread
From: George G. Davis @ 2021-08-25 13:58 UTC (permalink / raw)
  To: Shuah Khan, open list:KERNEL SELFTEST FRAMEWORK, open list
  Cc: george_davis, Eugeniu Rosca, George G. Davis

From: "George G. Davis" <davis.george@siemens.com>

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")
Signed-off-by: George G. Davis <davis.george@siemens.com>
---
 tools/testing/selftests/vm/transhuge-stress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
index fd7f1b4a96f9..5e4c036f6ad3 100644
--- a/tools/testing/selftests/vm/transhuge-stress.c
+++ b/tools/testing/selftests/vm/transhuge-stress.c
@@ -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)
-- 
2.17.1


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

* Re: [RFC][PATCH] selftests/vm/transhuge-stress: fix ram size thinko
  2021-08-25 13:58 [RFC][PATCH] selftests/vm/transhuge-stress: fix ram size thinko George G. Davis
@ 2021-09-28 17:58 ` George G. Davis
  2021-10-15 15:38 ` Shuah Khan
  1 sibling, 0 replies; 4+ messages in thread
From: George G. Davis @ 2021-09-28 17:58 UTC (permalink / raw)
  To: Shuah Khan, open list:KERNEL SELFTEST FRAMEWORK, open list
  Cc: Eugeniu Rosca, George G. Davis

On Wed, Aug 25, 2021 at 09:58:43AM -0400, George G. Davis wrote:
> From: "George G. Davis" <davis.george@siemens.com>
> 
> 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")
> Signed-off-by: George G. Davis <davis.george@siemens.com>
> ---
>  tools/testing/selftests/vm/transhuge-stress.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
> index fd7f1b4a96f9..5e4c036f6ad3 100644
> --- a/tools/testing/selftests/vm/transhuge-stress.c
> +++ b/tools/testing/selftests/vm/transhuge-stress.c
> @@ -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.

>  
>  	pagemap_fd = open("/proc/self/pagemap", O_RDONLY);
>  	if (pagemap_fd < 0)
> -- 
> 2.17.1
> 

-- 
Regards,
George

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

* Re: [RFC][PATCH] selftests/vm/transhuge-stress: fix ram size thinko
  2021-08-25 13:58 [RFC][PATCH] selftests/vm/transhuge-stress: fix ram size thinko George G. Davis
  2021-09-28 17:58 ` George G. Davis
@ 2021-10-15 15:38 ` Shuah Khan
  2021-10-15 19:29   ` Andrew Morton
  1 sibling, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2021-10-15 15:38 UTC (permalink / raw)
  To: George G. Davis, Shuah Khan, open list:KERNEL SELFTEST FRAMEWORK,
	open list, Andrew Morton
  Cc: Eugeniu Rosca, George G. Davis, Shuah Khan

On 8/25/21 7:58 AM, George G. Davis wrote:
> From: "George G. Davis" <davis.george@siemens.com>
> 
> 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")
> Signed-off-by: George G. Davis <davis.george@siemens.com>
> ---
>   tools/testing/selftests/vm/transhuge-stress.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
> index fd7f1b4a96f9..5e4c036f6ad3 100644
> --- a/tools/testing/selftests/vm/transhuge-stress.c
> +++ b/tools/testing/selftests/vm/transhuge-stress.c
> @@ -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

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

* Re: [RFC][PATCH] selftests/vm/transhuge-stress: fix ram size thinko
  2021-10-15 15:38 ` Shuah Khan
@ 2021-10-15 19:29   ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2021-10-15 19:29 UTC (permalink / raw)
  To: Shuah Khan
  Cc: George G. Davis, Shuah Khan, open list:KERNEL SELFTEST FRAMEWORK,
	open list, Eugeniu Rosca, George G. Davis, Konstantin Khlebnikov

On Fri, 15 Oct 2021 09:38:24 -0600 Shuah Khan <skhan@linuxfoundation.org> wrote:

> On 8/25/21 7:58 AM, George G. Davis wrote:
> > From: "George G. Davis" <davis.george@siemens.com>
> > 
> > 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")
> > Signed-off-by: George G. Davis <davis.george@siemens.com>
> > ---
> >   tools/testing/selftests/vm/transhuge-stress.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
> > index fd7f1b4a96f9..5e4c036f6ad3 100644
> > --- a/tools/testing/selftests/vm/transhuge-stress.c
> > +++ b/tools/testing/selftests/vm/transhuge-stress.c
> > @@ -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.

Konstantin, coould you please take a look?

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

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

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

end of thread, other threads:[~2021-10-15 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 13:58 [RFC][PATCH] selftests/vm/transhuge-stress: fix ram size thinko George G. Davis
2021-09-28 17:58 ` George G. Davis
2021-10-15 15:38 ` Shuah Khan
2021-10-15 19:29   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).