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

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.