All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/set_mempolicy04: fix node available memory check
@ 2022-05-19  8:51 Jan Stancek
  2022-05-19  9:50 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2022-05-19  8:51 UTC (permalink / raw)
  To: ltp

Formula for amount of needed memory on each node is wrong. Test is
currently using '20 * FILES' pages, which is 200 pages. But on 2 node
system it allocates up to 570 pages from single node.

Correct the formula to account for linear increase of allocated
pages with each outer loop iteration.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c b/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c
index 4399503c3054..2a1d2e1b9ad0 100644
--- a/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c
+++ b/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c
@@ -40,9 +40,11 @@ static struct tst_nodemap *nodes;
 
 static void setup(void)
 {
+	int node_min_pages = FILES * (FILES + 1) / 2 * 10 + FILES * 10;
+
 	page_size = getpagesize();
 
-	nodes = tst_get_nodemap(TST_NUMA_MEM, 20 * FILES * page_size / 1024);
+	nodes = tst_get_nodemap(TST_NUMA_MEM, node_min_pages * page_size / 1024);
 	if (nodes->cnt <= 1)
 		tst_brk(TCONF, "Test requires at least two NUMA memory nodes");
 }
-- 
2.27.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] syscalls/set_mempolicy04: fix node available memory check
  2022-05-19  8:51 [LTP] [PATCH] syscalls/set_mempolicy04: fix node available memory check Jan Stancek
@ 2022-05-19  9:50 ` Cyril Hrubis
  2022-05-19  9:55   ` Jan Stancek
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2022-05-19  9:50 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp

Hi!
> diff --git a/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c b/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c
> index 4399503c3054..2a1d2e1b9ad0 100644
> --- a/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c
> +++ b/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c
> @@ -40,9 +40,11 @@ static struct tst_nodemap *nodes;
>  
>  static void setup(void)
>  {
> +	int node_min_pages = FILES * (FILES + 1) / 2 * 10 + FILES * 10;
                             ^                              ^
			     10 * sum of 1 .. FILES         |
							And I guess this is
							upper bound for
							FILES * (j%10)

Looks good. I guess that I forget to update the estimate when the
allocation pattern got more complex.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

Also I guess that this should go in before the release.

>  	page_size = getpagesize();
>  
> -	nodes = tst_get_nodemap(TST_NUMA_MEM, 20 * FILES * page_size / 1024);
> +	nodes = tst_get_nodemap(TST_NUMA_MEM, node_min_pages * page_size / 1024);
>  	if (nodes->cnt <= 1)
>  		tst_brk(TCONF, "Test requires at least two NUMA memory nodes");
>  }
> -- 
> 2.27.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] syscalls/set_mempolicy04: fix node available memory check
  2022-05-19  9:50 ` Cyril Hrubis
@ 2022-05-19  9:55   ` Jan Stancek
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Stancek @ 2022-05-19  9:55 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: LTP List

On Thu, May 19, 2022 at 11:47 AM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> Hi!
> > diff --git a/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c b/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c
> > index 4399503c3054..2a1d2e1b9ad0 100644
> > --- a/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c
> > +++ b/testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c
> > @@ -40,9 +40,11 @@ static struct tst_nodemap *nodes;
> >
> >  static void setup(void)
> >  {
> > +     int node_min_pages = FILES * (FILES + 1) / 2 * 10 + FILES * 10;
>                              ^                              ^
>                              10 * sum of 1 .. FILES         |
>                                                         And I guess this is
>                                                         upper bound for
>                                                         FILES * (j%10)

Correct.

>
> Looks good. I guess that I forget to update the estimate when the
> allocation pattern got more complex.
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
>
> Also I guess that this should go in before the release.

Thanks, pushed.

>
> >       page_size = getpagesize();
> >
> > -     nodes = tst_get_nodemap(TST_NUMA_MEM, 20 * FILES * page_size / 1024);
> > +     nodes = tst_get_nodemap(TST_NUMA_MEM, node_min_pages * page_size / 1024);
> >       if (nodes->cnt <= 1)
> >               tst_brk(TCONF, "Test requires at least two NUMA memory nodes");
> >  }
> > --
> > 2.27.0
> >
> >
> > --
> > Mailing list info: https://lists.linux.it/listinfo/ltp
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2022-05-19  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19  8:51 [LTP] [PATCH] syscalls/set_mempolicy04: fix node available memory check Jan Stancek
2022-05-19  9:50 ` Cyril Hrubis
2022-05-19  9:55   ` Jan Stancek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.