ksm: Add max_runtime to tests
PATCH v2 1/1 ksm: Add max_runtime to tests
ksm02, ksm04 and ksm05 take 10+ seconds to finish. Set max_runtime to avoid random timeout issues.
---
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(-)
testcases/kernel/mem/ksm/ksm02.c +4 -0
@@ -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 }, };
testcases/kernel/mem/ksm/ksm04.c +4 -0
@@ -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 },
testcases/kernel/mem/ksm/ksm_common.h +3 -1
@@ -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,
Signature · 5 lines
2.37.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 2 lines
ksm02, ksm04 and ksm05 take 10+ seconds to finish. Set
max_runtimeto 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?
Quoted 87 lines
Signed-off-by Martin Doucha <[email protected]>---
Changes since v1:
- Increasedmax_runtimefrom 20s to 32s
- Added dynamic runtime calculation for non-default memsizeAfter 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 calculatemax_runtimefrom 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(-)testcases/kernel/mem/ksm/ksm02.c +4
-0@@ -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 }, };testcases/kernel/mem/ksm/ksm04.c +4
-0@@ -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 },testcases/kernel/mem/ksm/ksm_common.h +3
-1@@ -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,Signature · 5 lines
2.37.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 6 lines · Cyril Hrubis
Hi!
Quoted 2 lines
ksm02, ksm04 and ksm05 take 10+ seconds to finish. Set
max_runtimeto 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?
Yes, that's a leftover, ksm05 gets executed for a fixed period of time via the -I parameter in runfile so it doesn't need static max_runtime. Otherwise the test finishes almost instantly. I forgot to remove the mention in commit message, sorry about that.
Signature · 11 lines
Martin Doucha [email protected] QA Engineer for Software Maintenance SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 4 lines
Yes, that's a leftover, ksm05 gets executed for a fixed period of time via the -I parameter in runfile so it doesn't need static
max_runtime. Otherwise the test finishes almost instantly. I forgot to remove the mention in commit message, sorry about that.
I've fixed the commit message and pushed, thanks.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp