[LTP] [PATCH 1/7] ksm06: Move option parsing into the setup()

Cyril Hrubis chrubis@suse.cz
Thu Mar 3 15:50:26 CET 2022


Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/mem/ksm/ksm06.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/mem/ksm/ksm06.c b/testcases/kernel/mem/ksm/ksm06.c
index c5f219c37..379236f1f 100644
--- a/testcases/kernel/mem/ksm/ksm06.c
+++ b/testcases/kernel/mem/ksm/ksm06.c
@@ -42,17 +42,12 @@
 static int run = -1;
 static int sleep_millisecs = -1;
 static int merge_across_nodes = -1;
-static unsigned long nr_pages;
+static unsigned long nr_pages = 100;
 
 static char *n_opt;
 
 static void test_ksm(void)
 {
-	if (n_opt)
-		nr_pages = SAFE_STRTOUL(n_opt, 0, ULONG_MAX);
-	else
-		nr_pages = 100;
-
 	test_ksm_merge_across_nodes(nr_pages);
 }
 
@@ -64,6 +59,9 @@ static void setup(void)
 	if (!is_numa(NULL, NH_MEMS, 2))
 		tst_brk(TCONF, "The case needs a NUMA system.");
 
+	if (n_opt)
+		nr_pages = SAFE_STRTOUL(n_opt, 0, ULONG_MAX);
+
 	/* save the current value */
 	SAFE_FILE_SCANF(PATH_KSM "run", "%d", &run);
 	SAFE_FILE_SCANF(PATH_KSM "merge_across_nodes",
-- 
2.34.1



More information about the ltp mailing list