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

Richard Palethorpe rpalethorpe@suse.de
Mon Mar 7 14:02:22 CET 2022


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


-- 
Thank you,
Richard.


More information about the ltp mailing list