[LTP] [PATCH] syscalls/set_mempolicy04: fix node available memory check

Cyril Hrubis chrubis@suse.cz
Thu May 19 11:50:02 CEST 2022


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


More information about the ltp mailing list