summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorHaifeng Xu <haifeng.xu@shopee.com>2023-05-22 09:52:33 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-19 16:21:08 +0200
commitb27af27fc9d58084c0a3d0245079c804f54348e1 (patch)
tree0d8d0fc21d9db95622d4487aef0ba41e3f51ec03 /tools
parent75704a10eac2ee1f83a127e5ea6dff5bcfd3996f (diff)
downloadlinux-stable-b27af27fc9d58084c0a3d0245079c804f54348e1.tar.gz
linux-stable-b27af27fc9d58084c0a3d0245079c804f54348e1.tar.bz2
linux-stable-b27af27fc9d58084c0a3d0245079c804f54348e1.zip
selftests: cgroup: fix unexpected failure on test_memcg_low
[ Upstream commit 19ab365762c6cc39dfdee9e13ab0d12fe4b5540d ] Since commit f079a020ba95 ("selftests: memcg: factor out common parts of memory.{low,min} tests"), the value used in second alloc_anon has changed from 148M to 170M. Because memory.low allows reclaiming page cache in child cgroups, so the memory.current is close to 30M instead of 50M. Therefore, adjust the expected value of parent cgroup. Link: https://lkml.kernel.org/r/20230522095233.4246-2-haifeng.xu@shopee.com Fixes: f079a020ba95 ("selftests: memcg: factor out common parts of memory.{low,min} tests") Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Shakeel Butt <shakeelb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/cgroup/test_memcontrol.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c
index fe4f9f430282..5a526a8e7d33 100644
--- a/tools/testing/selftests/cgroup/test_memcontrol.c
+++ b/tools/testing/selftests/cgroup/test_memcontrol.c
@@ -284,6 +284,7 @@ static int test_memcg_protection(const char *root, bool min)
char *children[4] = {NULL};
const char *attribute = min ? "memory.min" : "memory.low";
long c[4];
+ long current;
int i, attempts;
int fd;
@@ -392,7 +393,8 @@ static int test_memcg_protection(const char *root, bool min)
goto cleanup;
}
- if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3))
+ current = min ? MB(50) : MB(30);
+ if (!values_close(cg_read_long(parent[1], "memory.current"), current, 3))
goto cleanup;
if (min) {