Skip to content

Commit c7d7713

Browse files
schladhtejun
authored andcommitted
selftests: cgroup: Allow longer timeout for kmem_dead_cgroups cleanup
The test_kmem_dead_cgroups test currently assumes that RCU and memory reclaim will complete within 5 seconds. In some environments this timeout may be insufficient, leading to spurious test failures. This patch introduces max_time set to 20 which is then used in the test. After 5th sec the debug message is printed to indicate the cleanup is still ongoing. In the system under test with 16 CPUs the original test was failing most of the time and the cleanup time took usually approx. 6sec. Further tests were conducted with and without do_rcu_barrier and the results (respectively) are as follow: quantiles 0 0.25 0.5 0.75 1 1 2 3 8 20 (mean = 4.7667) 3 5 8 8 20 (mean = 7.6667) Acked-by: Michal Koutny <[email protected]> Signed-off-by: Sebastian Chlad <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 633e6ba commit c7d7713

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/testing/selftests/cgroup/test_kmem.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ static int test_kmem_dead_cgroups(const char *root)
308308
char *parent;
309309
long dead;
310310
int i;
311+
int max_time = 20;
311312

312313
parent = cg_name(root, "kmem_dead_cgroups_test");
313314
if (!parent)
@@ -322,7 +323,7 @@ static int test_kmem_dead_cgroups(const char *root)
322323
if (cg_run_in_subcgroups(parent, alloc_dcache, (void *)100, 30))
323324
goto cleanup;
324325

325-
for (i = 0; i < 5; i++) {
326+
for (i = 0; i < max_time; i++) {
326327
dead = cg_read_key_long(parent, "cgroup.stat",
327328
"nr_dying_descendants ");
328329
if (dead == 0) {
@@ -334,6 +335,8 @@ static int test_kmem_dead_cgroups(const char *root)
334335
* let's wait a bit and repeat.
335336
*/
336337
sleep(1);
338+
if (i > 5)
339+
printf("Waiting time longer than 5s; wait: %ds (dead: %ld)\n", i, dead);
337340
}
338341

339342
cleanup:

0 commit comments

Comments
 (0)