[LTP] [PATCH 2/2] memcg/memcontrol0[34]: Remove protection from the top level group
Sebastian Chlad
sebastianchlad@gmail.com
Sat Sep 26 22:44:54 CEST 2026
From: Sebastian Chlad <sebastian.chlad@suse.com>
The memory pressure in both tests comes from A/G hitting the
memory.max of A, so A is the reclaim root. Protection of the reclaim
root is ignored by the kernel and the direct children of the root
(A/B and A/G) use their own memory.min/memory.low as is, see
page_counter_calculate_protection(). The 50M of memory.min
(memcontrol03) and memory.low (memcontrol04) set on A thus has no
effect on what the tests check; it would only protect the whole
hierarchy against reclaim from outside, which the tests don't need.
The kselftest the tests are ported from dropped it for the same reason
in kernel commit 6a35919005d4 ("selftests: memcg: remove protection
from top level memcg"). Do the same and correct the descriptions, as
the pressure is created in A, not in A/G.
Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
---
testcases/kernel/controllers/memcg/memcontrol03.c | 5 ++---
testcases/kernel/controllers/memcg/memcontrol04.c | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/controllers/memcg/memcontrol03.c b/testcases/kernel/controllers/memcg/memcontrol03.c
index aa94f4999..25b84c24e 100644
--- a/testcases/kernel/controllers/memcg/memcontrol03.c
+++ b/testcases/kernel/controllers/memcg/memcontrol03.c
@@ -5,7 +5,7 @@
*
* Original description:
* "First, this test creates the following hierarchy:
- * A memory.min = 50M, memory.max = 200M
+ * A memory.min = 0, memory.max = 200M
* A/B memory.min = 50M, memory.current = 50M
* A/B/C memory.min = 75M, memory.current = 50M
* A/B/D memory.min = 25M, memory.current = 50M
@@ -15,7 +15,7 @@
* Usages are pagecache, but the test keeps a running
* process in every leaf cgroup.
* Then it creates A/G and creates a significant
- * memory pressure in it.
+ * memory pressure in A.
*
* A/B memory.current ~= 50M
* A/B/C memory.current ~= 29M
@@ -194,7 +194,6 @@ static void test_memcg_min(void)
alloc_pagecache_in_child(leaf_cg[i], MB(50));
}
- SAFE_CG_PRINT(trunk_cg[A], "memory.min", "50M");
SAFE_CG_PRINT(trunk_cg[B], "memory.min", "50M");
SAFE_CG_PRINT(leaf_cg[C], "memory.min", "75M");
SAFE_CG_PRINT(leaf_cg[D], "memory.min", "25M");
diff --git a/testcases/kernel/controllers/memcg/memcontrol04.c b/testcases/kernel/controllers/memcg/memcontrol04.c
index 92ab53a51..f1e136df4 100644
--- a/testcases/kernel/controllers/memcg/memcontrol04.c
+++ b/testcases/kernel/controllers/memcg/memcontrol04.c
@@ -5,7 +5,7 @@
*
* Original description:
* "First, this test creates the following hierarchy:
- * A memory.low = 50M, memory.max = 200M
+ * A memory.low = 0, memory.max = 200M
* A/B memory.low = 50M, memory.current = 50M
* A/B/C memory.low = 75M, memory.current = 50M
* A/B/D memory.low = 25M, memory.current = 50M
@@ -14,7 +14,7 @@
*
* Usages are pagecache
* Then it creates A/G and creates a significant
- * memory pressure in it.
+ * memory pressure in A.
*
* A/B memory.current ~= 50M
* A/B/C memory.current ~= 29M
@@ -167,7 +167,6 @@ static void test_memcg_low(void)
alloc_pagecache_in_child(leaf_cg[i], MB(50));
}
- SAFE_CG_PRINT(trunk_cg[A], "memory.low", "50M");
SAFE_CG_PRINT(trunk_cg[B], "memory.low", "50M");
SAFE_CG_PRINT(leaf_cg[C], "memory.low", "75M");
SAFE_CG_PRINT(leaf_cg[D], "memory.low", "25M");
--
2.51.0
More information about the ltp
mailing list