Skip to content

Commit fac2650

Browse files
hnazakpm00
authored andcommitted
selftests: cgroup: fix test_kmem_basic false positives
This test fails routinely in our prod testing environment, and I can reproduce it locally as well. The test allocates dcache inside a cgroup, then drops the memory limit and checks that usage drops correspondingly. The reason it fails is because dentries are freed with an RCU delay - a debugging sleep shows that usage drops as expected shortly after. Insert a 1s sleep after dropping the limit. This should be good enough, assuming that machines running those tests are otherwise not very busy. Link: https://lkml.kernel.org/r/20230801135632.1768830-1-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Paul E. McKenney <paulmck@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 1745778 commit fac2650

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/testing/selftests/cgroup/test_kmem.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ static int test_kmem_basic(const char *root)
7070
goto cleanup;
7171

7272
cg_write(cg, "memory.high", "1M");
73+
74+
/* wait for RCU freeing */
75+
sleep(1);
76+
7377
slab1 = cg_read_key_long(cg, "memory.stat", "slab ");
7478
if (slab1 <= 0)
7579
goto cleanup;

0 commit comments

Comments
 (0)