[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <edpx3ejic2cxolhoynxvwal2i4a35akopg6hshcfxker6oxcn7@l32pzfyucgec>
Date: Fri, 4 Aug 2023 11:37:33 -0400
From: Lucas Karpinski <lkarpins@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Shakeel Butt <shakeelb@...gle.com>,
Muchun Song <muchun.song@...ux.dev>, Tejun Heo <tj@...nel.org>,
Zefan Li <lizefan.x@...edance.com>,
Shuah Khan <shuah@...nel.org>
Cc: Muchun Song <muchun.song@...ux.dev>, cgroups@...r.kernel.org,
linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] selftests: cgroup: fix test_kmem_memcg_deletion false
positives
The test allocates dcache inside a cgroup, then destroys the cgroups and
then checks the sanity of numbers on the parent level. 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 completing the cgroup creation/deletions. This
should be good enough, assuming that machines running those tests are
otherwise not very busy. This commit is directly inspired by Johannes
over at the link below.
Link: https://lore.kernel.org/all/20230801135632.1768830-1-hannes@cmpxchg.org/
Signed-off-by: Lucas Karpinski <lkarpins@...hat.com>
---
tools/testing/selftests/cgroup/test_kmem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
index 67cc0182058d..7ac384bbfdd5 100644
--- a/tools/testing/selftests/cgroup/test_kmem.c
+++ b/tools/testing/selftests/cgroup/test_kmem.c
@@ -183,6 +183,9 @@ static int test_kmem_memcg_deletion(const char *root)
if (cg_run_in_subcgroups(parent, alloc_kmem_smp, NULL, 100))
goto cleanup;
+ /* wait for RCU freeing */
+ sleep(1);
+
current = cg_read_long(parent, "memory.current");
slab = cg_read_key_long(parent, "memory.stat", "slab ");
anon = cg_read_key_long(parent, "memory.stat", "anon ");
--
2.41.0
Powered by blists - more mailing lists