diff mbox series

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

Message ID 20220303145032.21493-2-chrubis@suse.cz
State Accepted
Headers show
Series ksm06 and libnuma cleanups and fixes | expand

Commit Message

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

Comments

Richard Palethorpe March 7, 2022, 1:02 p.m. UTC | #1
Hi,

Cyril Hrubis <chrubis@suse.cz> writes:

> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>

Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>

> ---
>  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
diff mbox series

Patch

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",