linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] selftests: cgroup: fix unexpected failure on test_memcg_low
@ 2023-05-22  9:52 Haifeng Xu
  2023-05-23 14:40 ` Michal Koutný
  0 siblings, 1 reply; 2+ messages in thread
From: Haifeng Xu @ 2023-05-22  9:52 UTC (permalink / raw)
  To: mhocko
  Cc: roman.gushchin, hannes, shakeelb, akpm, cgroups, linux-mm,
	linux-kernel, Haifeng Xu

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.

Fixes: f079a020ba95 ("selftests: memcg: factor out common parts of memory.{low,min} tests")
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
 tools/testing/selftests/cgroup/test_memcontrol.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c
index f4f7c0aef702..a2a90f4bfe9f 100644
--- a/tools/testing/selftests/cgroup/test_memcontrol.c
+++ b/tools/testing/selftests/cgroup/test_memcontrol.c
@@ -292,6 +292,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;
 
@@ -400,7 +401,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 (!reclaim_until(children[0], MB(10)))
-- 
2.25.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] selftests: cgroup: fix unexpected failure on test_memcg_low
  2023-05-22  9:52 [PATCH 2/2] selftests: cgroup: fix unexpected failure on test_memcg_low Haifeng Xu
@ 2023-05-23 14:40 ` Michal Koutný
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Koutný @ 2023-05-23 14:40 UTC (permalink / raw)
  To: Haifeng Xu
  Cc: mhocko, roman.gushchin, hannes, shakeelb, akpm, cgroups,
	linux-mm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]

On Mon, May 22, 2023 at 09:52:33AM +0000, Haifeng Xu <haifeng.xu@shopee.com> wrote:
> 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.
> 
> Fixes: f079a020ba95 ("selftests: memcg: factor out common parts of memory.{low,min} tests")
> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
> ---
>  tools/testing/selftests/cgroup/test_memcontrol.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Yes, the expected value should be complement of the allocation to the
limit when reclaim is allowed.

Reviewed-by: Michal Koutný <mkoutny@suse.com>

FTR, the test_memcg_low fails after the fix still (6.3.1-2-default)
because of nonzero memory.events:low in the unprotected A/B/E group
(with memory_recursiveprot).
(That's another and long standing issues -- perhaps the reason why this
issue was hidden.)

Thanks,
Michal

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-23 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22  9:52 [PATCH 2/2] selftests: cgroup: fix unexpected failure on test_memcg_low Haifeng Xu
2023-05-23 14:40 ` Michal Koutný

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox