public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] ksm: Add max_runtime to tests
Date: Fri, 16 Sep 2022 10:40:43 +0200	[thread overview]
Message-ID: <YyQ2i0t6JEL0ksib@yuki> (raw)
In-Reply-To: <20220915160343.21773-1-mdoucha@suse.cz>

Hi!
> ksm02, ksm04 and ksm05 take 10+ seconds to finish. Set max_runtime to avoid
> random timeout issues.

The patch looks good. I guess that the ksm05 in the description is a
leftover and should be removed before applying, right?

> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
> 
> Changes since v1:
> - Increased max_runtime from 20s to 32s
> - Added dynamic runtime calculation for non-default memsize
> 
> After some experiments it turns out that the total amount of RAM doesn't
> matter, ksmd will scan only pages marked with MADV_MERGEABLE. So unless
> another process interferes with the test, we can calculate max_runtime
> from the memory size parameter.
> 
> The create_same_memory() function will run 4 ksm scan on each call which
> takes about 2 seconds with the default memory size. Both ksm02 and ksm04
> call it twice which means 16 seconds of runtime by default. Let's raise it
> to 32 for some safety margin on slower systems.
> 
>  testcases/kernel/mem/ksm/ksm02.c      | 4 ++++
>  testcases/kernel/mem/ksm/ksm04.c      | 4 ++++
>  testcases/kernel/mem/ksm/ksm_common.h | 4 +++-
>  3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/mem/ksm/ksm02.c b/testcases/kernel/mem/ksm/ksm02.c
> index 1cb7d8e73..4183108d5 100644
> --- a/testcases/kernel/mem/ksm/ksm02.c
> +++ b/testcases/kernel/mem/ksm/ksm02.c
> @@ -85,6 +85,9 @@ static void verify_ksm(void)
>  static void setup(void)
>  {
>  	parse_ksm_options(opt_sizestr, &size, opt_numstr, &num, opt_unitstr, &unit);
> +
> +	if (opt_sizestr && size > DEFAULT_MEMSIZE)
> +		tst_set_max_runtime(32 * (size / DEFAULT_MEMSIZE));
>  }
>  
>  static struct tst_test test = {
> @@ -110,6 +113,7 @@ static struct tst_test test = {
>  	},
>  	.test_all = verify_ksm,
>  	.min_kver = "2.6.32",
> +	.max_runtime = 32,
>  	.needs_cgroup_ctrls = (const char *const []){ "cpuset", NULL },
>  };
>  
> diff --git a/testcases/kernel/mem/ksm/ksm04.c b/testcases/kernel/mem/ksm/ksm04.c
> index 39c741876..9fe9d6dd5 100644
> --- a/testcases/kernel/mem/ksm/ksm04.c
> +++ b/testcases/kernel/mem/ksm/ksm04.c
> @@ -87,6 +87,9 @@ static void setup(void)
>  	parse_ksm_options(opt_sizestr, &size, opt_numstr, &num, opt_unitstr, &unit);
>  
>  	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
> +
> +	if (opt_sizestr && size > DEFAULT_MEMSIZE)
> +		tst_set_max_runtime(32 * (size / DEFAULT_MEMSIZE));
>  }
>  
>  static struct tst_test test = {
> @@ -112,6 +115,7 @@ static struct tst_test test = {
>  	},
>  	.test_all = verify_ksm,
>  	.min_kver = "2.6.32",
> +	.max_runtime = 32,
>  	.needs_cgroup_ctrls = (const char *const []){
>  		"memory", "cpuset", NULL
>  	},
> diff --git a/testcases/kernel/mem/ksm/ksm_common.h b/testcases/kernel/mem/ksm/ksm_common.h
> index 56faf01e4..a582891c6 100644
> --- a/testcases/kernel/mem/ksm/ksm_common.h
> +++ b/testcases/kernel/mem/ksm/ksm_common.h
> @@ -9,7 +9,9 @@
>  
>  #include "tst_test.h"
>  
> -int size = 128, num = 3, unit = 1;
> +#define DEFAULT_MEMSIZE 128
> +
> +int size = DEFAULT_MEMSIZE, num = 3, unit = 1;
>  char *opt_sizestr, *opt_numstr, *opt_unitstr;
>  
>  static inline void parse_ksm_options(char *str_size, int *size,
> -- 
> 2.37.3
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-09-16  8:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 16:03 [LTP] [PATCH v2] ksm: Add max_runtime to tests Martin Doucha
2022-09-16  8:40 ` Cyril Hrubis [this message]
2022-09-16  8:46   ` Martin Doucha
2022-09-16  9:01     ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YyQ2i0t6JEL0ksib@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox