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

Jan Stancek jstancek@redhat.com
Thu May 19 10:51:08 CEST 2022


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



More information about the ltp mailing list