[LTP] [PATCH v2] set_mempolicy01: adjust the maximum runtime base on nodes

Li Wang liwang@redhat.com
Fri Dec 30 04:21:02 CET 2022


In most cases, set_mempolicy01 finish quickly, but when the platform
has multiple NUMA nodes, the test matrix combination grows exponentially
and brings about test time to increase extremely fast. Here propose to
set the maximum runtime dynamically according to the system nodes.

  ========= test log on 16 nodes system =========
  ...
  set_mempolicy01.c:80: TPASS: child: Node 15 allocated 16
  tst_numa.c:25: TINFO: Node 0 allocated 0 pages
  tst_numa.c:25: TINFO: Node 1 allocated 0 pages
  tst_numa.c:25: TINFO: Node 2 allocated 0 pages
  tst_numa.c:25: TINFO: Node 3 allocated 0 pages
  tst_numa.c:25: TINFO: Node 4 allocated 0 pages
  tst_numa.c:25: TINFO: Node 5 allocated 0 pages
  tst_numa.c:25: TINFO: Node 6 allocated 0 pages
  tst_numa.c:25: TINFO: Node 7 allocated 0 pages
  tst_numa.c:25: TINFO: Node 8 allocated 0 pages
  tst_numa.c:25: TINFO: Node 9 allocated 0 pages
  tst_numa.c:25: TINFO: Node 10 allocated 0 pages
  tst_numa.c:25: TINFO: Node 11 allocated 0 pages
  tst_numa.c:25: TINFO: Node 12 allocated 0 pages
  tst_numa.c:25: TINFO: Node 13 allocated 0 pages
  tst_numa.c:25: TINFO: Node 14 allocated 0 pages
  tst_numa.c:25: TINFO: Node 15 allocated 16 pages
  set_mempolicy01.c:80: TPASS: parent: Node 15 allocated 16

  Summary:
  passed   393210
  failed   0
  broken   0
  skipped  0
  warnings 0

  real	6m15.147s
  user	0m33.641s
  sys	0m44.553s

Signed-off-by: Li Wang <liwang@redhat.com>
---
 .../kernel/syscalls/set_mempolicy/set_mempolicy01.c    | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/testcases/kernel/syscalls/set_mempolicy/set_mempolicy01.c b/testcases/kernel/syscalls/set_mempolicy/set_mempolicy01.c
index 07f5d789b..e9712b7be 100644
--- a/testcases/kernel/syscalls/set_mempolicy/set_mempolicy01.c
+++ b/testcases/kernel/syscalls/set_mempolicy/set_mempolicy01.c
@@ -35,6 +35,15 @@ static void setup(void)
 	nodes = tst_get_nodemap(TST_NUMA_MEM, 2 * PAGES_ALLOCATED * page_size / 1024);
 	if (nodes->cnt <= 1)
 		tst_brk(TCONF, "Test requires at least two NUMA memory nodes");
+
+	/*
+	 * In most cases, set_mempolicy01 finish quickly, but when the platform
+	 * has multiple NUMA nodes, the test matrix combination grows exponentially
+	 * and bring about test time to increase extremely fast.
+	 *
+	 * Here reset the maximum runtime according to the NUMA nodes.
+	 */
+	tst_set_max_runtime(test.max_runtime * (1 << nodes->cnt/16));
 }
 
 static void cleanup(void)
@@ -110,6 +119,7 @@ static struct tst_test test = {
 	.tcnt = 2,
 	.forks_child = 1,
 	.needs_checkpoints = 1,
+	.max_runtime = 600,
 };
 
 #else
-- 
2.38.1



More information about the ltp mailing list