* [LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model
@ 2026-09-26 20:44 Sebastian Chlad
2026-09-26 20:44 ` [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the " Sebastian Chlad
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Sebastian Chlad @ 2026-09-26 20:44 UTC (permalink / raw)
To: ltp; +Cc: Sebastian Chlad
From: Sebastian Chlad <sebastian.chlad@suse.com>
memcontrol03 (memory.min) and memcontrol04 (memory.low) were ported
from the kselftest test_memcontrol.c in 2022, but they still follow the
2018 version of it. The kselftest has since reworked this exact test
three times, and none of that reached LTP:
- f10b6e9a8e66 ("selftests: memcg: adjust expected reclaim values of
protected cgroups") replaced the hand-picked A/B/C ~= 33M and
A/B/D ~= 17M with values from a simulation of the kernel's protection
distribution (memcg_protection.m): 29M and 21M.
- 6a35919005d4 ("selftests: memcg: remove protection from top level
memcg") dropped memory.min/memory.low on A, which has no effect since
A is the reclaim root.
- d2def68ae06a ("selftests: memcg: increase error tolerance of child
memory.current check in test_memcg_protection()") widened the
tolerances to 15% (C) and 20% (D) because of sporadic failures.
The first one is what matters here. Kernels behave as the model says,
so D ends up close to 21M and sits right at the edge of the old
17M +/- 20% range. On x86_64 D was at ~90% of the upper limit in every
run, and small variations in reclaim are enough to fail it. With the
model values both C and D sit in the middle of their ranges (~8M of
margin each, 50+ iterations per test). LTP's tolerance is
already 20% for both, so the third commit needs no change.
Patch 1 updates the expected values, patch 2 removes the top level
protection. Both apply to memcontrol03 and memcontrol04.
This does not make every failure go away. On ppc64le we also see runs
where the most protected group C is reclaimed down to a few MB while the
unprotected A/B/F keeps its pagecache. That is protection working the
wrong way round, not a tolerance problem, and the tests should keep
reporting it.
Sebastian Chlad (2):
memcg/memcontrol0[34]: Use expected values from the protection model
memcg/memcontrol0[34]: Remove protection from the top level group
.../kernel/controllers/memcg/memcontrol03.c | 18 +++++++++---------
.../kernel/controllers/memcg/memcontrol04.c | 18 +++++++++---------
2 files changed, 18 insertions(+), 18 deletions(-)
--
2.51.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the protection model
2026-09-26 20:44 [LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model Sebastian Chlad
@ 2026-09-26 20:44 ` Sebastian Chlad
2026-09-28 6:27 ` Wei Gao via ltp
` (2 more replies)
2026-09-26 20:44 ` [LTP] [PATCH 2/2] memcg/memcontrol0[34]: Remove protection from the top level group Sebastian Chlad
2026-09-30 18:36 ` [LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model Cyril Hrubis
2 siblings, 3 replies; 9+ messages in thread
From: Sebastian Chlad @ 2026-09-26 20:44 UTC (permalink / raw)
To: ltp; +Cc: Sebastian Chlad
From: Sebastian Chlad <sebastian.chlad@suse.com>
memcontrol03 (memory.min) and memcontrol04 (memory.low) still expect
A/B/C ~= 33M and A/B/D ~= 17M after reclaim, which are the values from
the original kselftest. These were never derived from how the kernel
distributes protection among siblings, and the kselftest replaced them
with simulated values for both tests in kernel commit f10b6e9a8e66
("selftests: memcg: adjust expected reclaim values of protected
cgroups"):
A/B/C memory.current ~= 29M
A/B/D memory.current ~= 21M
(see tools/testing/selftests/cgroup/memcg_protection.m for the model).
Real kernels match the model, so the old D target leaves very little
room below the upper bound of the 20% tolerance. On 6.12 x86_64, 105
iterations of memcontrol03 across ext2, ext3, ext4, xfs and btrfs gave:
A/B/C 27.5M - 27.9M (old range 22.0M - 49.5M)
A/B/D 22.7M - 23.0M (old range 11.3M - 25.5M)
so A/B/D is already at ~90% of the old limit and small variations in
reclaim push it over. Passing runs on 6.4 ppc64le show the same
picture for both tests (C 22.6M - 32.0M, D 17.6M - 24.2M).
Switch to the model values. Keep the 20% tolerance, which is already
at least as wide as the kselftest's; kernel commit d2def68ae06a
("selftests: memcg: increase error tolerance of child memory.current
check in test_memcg_protection()") raised the kselftest tolerances to
15% (C) and 20% (D) for the same kind of sporadic failures.
This doesn't change the outcome where C is reclaimed far below D while
the unprotected A/B/F keeps its pagecache (seen e.g. on ppc64le with
C ~= 6M and F ~= 13M). That is a protection failure the tests should
keep reporting.
Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
---
testcases/kernel/controllers/memcg/memcontrol03.c | 13 +++++++------
testcases/kernel/controllers/memcg/memcontrol04.c | 13 +++++++------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/testcases/kernel/controllers/memcg/memcontrol03.c b/testcases/kernel/controllers/memcg/memcontrol03.c
index 96224c4ee..aa94f4999 100644
--- a/testcases/kernel/controllers/memcg/memcontrol03.c
+++ b/testcases/kernel/controllers/memcg/memcontrol03.c
@@ -18,9 +18,10 @@
* memory pressure in it.
*
* A/B memory.current ~= 50M
- * A/B/C memory.current ~= 33M
- * A/B/D memory.current ~= 17M
+ * A/B/C memory.current ~= 29M
+ * A/B/D memory.current ~= 21M
* A/B/E memory.current ~= 0
+ * (for origin of the numbers, see model in memcg_protection.m.)
*
* After that it tries to allocate more than there is unprotected
* memory in A available, and checks that memory.min protects
@@ -217,10 +218,10 @@ static void test_memcg_min(void)
for (i = 0; i < ARRAY_SIZE(leaf_cg); i++)
SAFE_CG_SCANF(leaf_cg[i], "memory.current", "%ld", c + i);
- TST_EXP_EXPR(values_close(c[0], MB(33), 20),
- "(A/B/C memory.current=%ld) ~= %d", c[0], MB(33));
- TST_EXP_EXPR(values_close(c[1], MB(17), 20),
- "(A/B/D memory.current=%ld) ~= %d", c[1], MB(17));
+ TST_EXP_EXPR(values_close(c[0], MB(29), 20),
+ "(A/B/C memory.current=%ld) ~= %d", c[0], MB(29));
+ TST_EXP_EXPR(values_close(c[1], MB(21), 20),
+ "(A/B/D memory.current=%ld) ~= %d", c[1], MB(21));
TST_EXP_EXPR(values_close(c[2], 0, 1),
"(A/B/E memory.current=%ld) ~= 0", c[2]);
diff --git a/testcases/kernel/controllers/memcg/memcontrol04.c b/testcases/kernel/controllers/memcg/memcontrol04.c
index 22ca1df8c..92ab53a51 100644
--- a/testcases/kernel/controllers/memcg/memcontrol04.c
+++ b/testcases/kernel/controllers/memcg/memcontrol04.c
@@ -17,9 +17,10 @@
* memory pressure in it.
*
* A/B memory.current ~= 50M
- * A/B/C memory.current ~= 33M
- * A/B/D memory.current ~= 17M
+ * A/B/C memory.current ~= 29M
+ * A/B/D memory.current ~= 21M
* A/B/E memory.current ~= 0
+ * (for origin of the numbers, see model in memcg_protection.m.)
*
* After that it tries to allocate more than there is unprotected
* memory in A available, and checks that memory.low protects
@@ -182,10 +183,10 @@ static void test_memcg_low(void)
for (i = 0; i < ARRAY_SIZE(leaf_cg); i++)
SAFE_CG_SCANF(leaf_cg[i], "memory.current", "%ld", c + i);
- TST_EXP_EXPR(values_close(c[0], MB(33), 20),
- "(A/B/C memory.current=%ld) ~= %d", c[C], MB(33));
- TST_EXP_EXPR(values_close(c[1], MB(17), 20),
- "(A/B/D memory.current=%ld) ~= %d", c[D], MB(17));
+ TST_EXP_EXPR(values_close(c[0], MB(29), 20),
+ "(A/B/C memory.current=%ld) ~= %d", c[C], MB(29));
+ TST_EXP_EXPR(values_close(c[1], MB(21), 20),
+ "(A/B/D memory.current=%ld) ~= %d", c[D], MB(21));
TST_EXP_EXPR(values_close(c[2], 0, 1),
"(A/B/E memory.current=%ld) ~= 0", c[E]);
tst_res(TINFO, "A/B/F memory.current=%ld", c[F]);
--
2.51.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [LTP] [PATCH 2/2] memcg/memcontrol0[34]: Remove protection from the top level group
2026-09-26 20:44 [LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model Sebastian Chlad
2026-09-26 20:44 ` [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the " Sebastian Chlad
@ 2026-09-26 20:44 ` Sebastian Chlad
2026-09-28 6:31 ` Wei Gao via ltp
2026-09-30 15:04 ` Michal Koutný via ltp
2026-09-30 18:36 ` [LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model Cyril Hrubis
2 siblings, 2 replies; 9+ messages in thread
From: Sebastian Chlad @ 2026-09-26 20:44 UTC (permalink / raw)
To: ltp; +Cc: Sebastian Chlad
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the protection model
2026-09-26 20:44 ` [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the " Sebastian Chlad
@ 2026-09-28 6:27 ` Wei Gao via ltp
2026-09-29 7:06 ` [LTP] " linuxtestproject.agent
2026-09-30 15:04 ` [LTP] [PATCH 1/2] " Michal Koutný via ltp
2 siblings, 0 replies; 9+ messages in thread
From: Wei Gao via ltp @ 2026-09-28 6:27 UTC (permalink / raw)
To: Sebastian Chlad; +Cc: Sebastian Chlad, ltp
On Sat, Sep 26, 2026 at 10:44:53PM +0200, Sebastian Chlad wrote:
> From: Sebastian Chlad <sebastian.chlad@suse.com>
>
> memcontrol03 (memory.min) and memcontrol04 (memory.low) still expect
> A/B/C ~= 33M and A/B/D ~= 17M after reclaim, which are the values from
> the original kselftest. These were never derived from how the kernel
> distributes protection among siblings, and the kselftest replaced them
> with simulated values for both tests in kernel commit f10b6e9a8e66
> ("selftests: memcg: adjust expected reclaim values of protected
> cgroups"):
>
> A/B/C memory.current ~= 29M
> A/B/D memory.current ~= 21M
>
> (see tools/testing/selftests/cgroup/memcg_protection.m for the model).
>
> Real kernels match the model, so the old D target leaves very little
> room below the upper bound of the 20% tolerance. On 6.12 x86_64, 105
> iterations of memcontrol03 across ext2, ext3, ext4, xfs and btrfs gave:
>
> A/B/C 27.5M - 27.9M (old range 22.0M - 49.5M)
> A/B/D 22.7M - 23.0M (old range 11.3M - 25.5M)
>
> so A/B/D is already at ~90% of the old limit and small variations in
> reclaim push it over. Passing runs on 6.4 ppc64le show the same
> picture for both tests (C 22.6M - 32.0M, D 17.6M - 24.2M).
>
> Switch to the model values. Keep the 20% tolerance, which is already
> at least as wide as the kselftest's; kernel commit d2def68ae06a
> ("selftests: memcg: increase error tolerance of child memory.current
> check in test_memcg_protection()") raised the kselftest tolerances to
> 15% (C) and 20% (D) for the same kind of sporadic failures.
>
> This doesn't change the outcome where C is reclaimed far below D while
> the unprotected A/B/F keeps its pagecache (seen e.g. on ppc64le with
> C ~= 6M and F ~= 13M). That is a protection failure the tests should
> keep reporting.
>
> Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
> ---
> testcases/kernel/controllers/memcg/memcontrol03.c | 13 +++++++------
> testcases/kernel/controllers/memcg/memcontrol04.c | 13 +++++++------
> 2 files changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/testcases/kernel/controllers/memcg/memcontrol03.c b/testcases/kernel/controllers/memcg/memcontrol03.c
> index 96224c4ee..aa94f4999 100644
> --- a/testcases/kernel/controllers/memcg/memcontrol03.c
> +++ b/testcases/kernel/controllers/memcg/memcontrol03.c
> @@ -18,9 +18,10 @@
> * memory pressure in it.
> *
> * A/B memory.current ~= 50M
> - * A/B/C memory.current ~= 33M
> - * A/B/D memory.current ~= 17M
> + * A/B/C memory.current ~= 29M
> + * A/B/D memory.current ~= 21M
> * A/B/E memory.current ~= 0
> + * (for origin of the numbers, see model in memcg_protection.m.)
> *
> * After that it tries to allocate more than there is unprotected
> * memory in A available, and checks that memory.min protects
> @@ -217,10 +218,10 @@ static void test_memcg_min(void)
> for (i = 0; i < ARRAY_SIZE(leaf_cg); i++)
> SAFE_CG_SCANF(leaf_cg[i], "memory.current", "%ld", c + i);
>
> - TST_EXP_EXPR(values_close(c[0], MB(33), 20),
> - "(A/B/C memory.current=%ld) ~= %d", c[0], MB(33));
> - TST_EXP_EXPR(values_close(c[1], MB(17), 20),
> - "(A/B/D memory.current=%ld) ~= %d", c[1], MB(17));
> + TST_EXP_EXPR(values_close(c[0], MB(29), 20),
> + "(A/B/C memory.current=%ld) ~= %d", c[0], MB(29));
> + TST_EXP_EXPR(values_close(c[1], MB(21), 20),
> + "(A/B/D memory.current=%ld) ~= %d", c[1], MB(21));
> TST_EXP_EXPR(values_close(c[2], 0, 1),
> "(A/B/E memory.current=%ld) ~= 0", c[2]);
>
> diff --git a/testcases/kernel/controllers/memcg/memcontrol04.c b/testcases/kernel/controllers/memcg/memcontrol04.c
> index 22ca1df8c..92ab53a51 100644
> --- a/testcases/kernel/controllers/memcg/memcontrol04.c
> +++ b/testcases/kernel/controllers/memcg/memcontrol04.c
> @@ -17,9 +17,10 @@
> * memory pressure in it.
> *
> * A/B memory.current ~= 50M
> - * A/B/C memory.current ~= 33M
> - * A/B/D memory.current ~= 17M
> + * A/B/C memory.current ~= 29M
> + * A/B/D memory.current ~= 21M
> * A/B/E memory.current ~= 0
> + * (for origin of the numbers, see model in memcg_protection.m.)
> *
> * After that it tries to allocate more than there is unprotected
> * memory in A available, and checks that memory.low protects
> @@ -182,10 +183,10 @@ static void test_memcg_low(void)
> for (i = 0; i < ARRAY_SIZE(leaf_cg); i++)
> SAFE_CG_SCANF(leaf_cg[i], "memory.current", "%ld", c + i);
>
> - TST_EXP_EXPR(values_close(c[0], MB(33), 20),
> - "(A/B/C memory.current=%ld) ~= %d", c[C], MB(33));
> - TST_EXP_EXPR(values_close(c[1], MB(17), 20),
> - "(A/B/D memory.current=%ld) ~= %d", c[D], MB(17));
> + TST_EXP_EXPR(values_close(c[0], MB(29), 20),
> + "(A/B/C memory.current=%ld) ~= %d", c[C], MB(29));
> + TST_EXP_EXPR(values_close(c[1], MB(21), 20),
> + "(A/B/D memory.current=%ld) ~= %d", c[D], MB(21));
> TST_EXP_EXPR(values_close(c[2], 0, 1),
> "(A/B/E memory.current=%ld) ~= 0", c[E]);
> tst_res(TINFO, "A/B/F memory.current=%ld", c[F]);
> --
> 2.51.0
Reviewed-by: Wei Gao <wegao@suse.com>
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 2/2] memcg/memcontrol0[34]: Remove protection from the top level group
2026-09-26 20:44 ` [LTP] [PATCH 2/2] memcg/memcontrol0[34]: Remove protection from the top level group Sebastian Chlad
@ 2026-09-28 6:31 ` Wei Gao via ltp
2026-09-30 15:04 ` Michal Koutný via ltp
1 sibling, 0 replies; 9+ messages in thread
From: Wei Gao via ltp @ 2026-09-28 6:31 UTC (permalink / raw)
To: Sebastian Chlad; +Cc: Sebastian Chlad, ltp
On Sat, Sep 26, 2026 at 10:44:54PM +0200, Sebastian Chlad wrote:
> 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
Reviewed-by: Wei Gao <wegao@suse.com>
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] memcg/memcontrol0[34]: Use expected values from the protection model
2026-09-26 20:44 ` [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the " Sebastian Chlad
2026-09-28 6:27 ` Wei Gao via ltp
@ 2026-09-29 7:06 ` linuxtestproject.agent
2026-09-30 15:04 ` [LTP] [PATCH 1/2] " Michal Koutný via ltp
2 siblings, 0 replies; 9+ messages in thread
From: linuxtestproject.agent @ 2026-09-29 7:06 UTC (permalink / raw)
To: Sebastian Chlad; +Cc: ltp
Hi Sebastian,
On Sat, 26 Sep 2026 22:44:53 +0200, Sebastian Chlad wrote:
> memcg/memcontrol0[34]: Use expected values from the protection model
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the protection model
2026-09-26 20:44 ` [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the " Sebastian Chlad
2026-09-28 6:27 ` Wei Gao via ltp
2026-09-29 7:06 ` [LTP] " linuxtestproject.agent
@ 2026-09-30 15:04 ` Michal Koutný via ltp
2 siblings, 0 replies; 9+ messages in thread
From: Michal Koutný via ltp @ 2026-09-30 15:04 UTC (permalink / raw)
To: Sebastian Chlad; +Cc: Sebastian Chlad, ltp
Hello.
On Sat, Sep 26, 2026 at 10:44:53PM +0200, Sebastian Chlad <sebastianchlad@gmail.com> wrote:
> From: Sebastian Chlad <sebastian.chlad@suse.com>
>
> memcontrol03 (memory.min) and memcontrol04 (memory.low) still expect
> A/B/C ~= 33M and A/B/D ~= 17M after reclaim, which are the values from
> the original kselftest. These were never derived from how the kernel
> distributes protection among siblings, and the kselftest replaced them
> with simulated values for both tests in kernel commit f10b6e9a8e66
> ("selftests: memcg: adjust expected reclaim values of protected
> cgroups"):
>
> A/B/C memory.current ~= 29M
> A/B/D memory.current ~= 21M
>
> (see tools/testing/selftests/cgroup/memcg_protection.m for the model).
>
> Real kernels match the model,
Note: this was true at the time of the model introduction but the
contemporary kernels may diverge slightly from it. (Not conceptually
AFAIR, although some rounding / effective values caching could possibly
affect the final values.)
> so the old D target leaves very little
> room below the upper bound of the 20% tolerance. On 6.12 x86_64, 105
> iterations of memcontrol03 across ext2, ext3, ext4, xfs and btrfs gave:
>
> A/B/C 27.5M - 27.9M (old range 22.0M - 49.5M)
> A/B/D 22.7M - 23.0M (old range 11.3M - 25.5M)
>
> so A/B/D is already at ~90% of the old limit and small variations in
> reclaim push it over. Passing runs on 6.4 ppc64le show the same
> picture for both tests (C 22.6M - 32.0M, D 17.6M - 24.2M).
>
> Switch to the model values. Keep the 20% tolerance, which is already
> at least as wide as the kselftest's; kernel commit d2def68ae06a
> ("selftests: memcg: increase error tolerance of child memory.current
> check in test_memcg_protection()") raised the kselftest tolerances to
> 15% (C) and 20% (D) for the same kind of sporadic failures.
Makes sense to sync this with the kernel variant.
Reviewed-by: Michal Koutný <mkoutny@suse.com>
> This doesn't change the outcome where C is reclaimed far below D while
> the unprotected A/B/F keeps its pagecache (seen e.g. on ppc64le with
> C ~= 6M and F ~= 13M). That is a protection failure the tests should
> keep reporting.
I presume you refer the same reclaim mode "collapse" that was tackled in
7e19705f7 ("memcg/memcontrol04: Fix judgment for recursive_protection")
(there it was only for unexpected events but that could be connected
with the unexpected final F.memory.current). It is nothing new, correct?
Thanks,
Michal
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 2/2] memcg/memcontrol0[34]: Remove protection from the top level group
2026-09-26 20:44 ` [LTP] [PATCH 2/2] memcg/memcontrol0[34]: Remove protection from the top level group Sebastian Chlad
2026-09-28 6:31 ` Wei Gao via ltp
@ 2026-09-30 15:04 ` Michal Koutný via ltp
1 sibling, 0 replies; 9+ messages in thread
From: Michal Koutný via ltp @ 2026-09-30 15:04 UTC (permalink / raw)
To: Sebastian Chlad; +Cc: Sebastian Chlad, ltp
On Sat, Sep 26, 2026 at 10:44:54PM +0200, Sebastian Chlad <sebastianchlad@gmail.com> wrote:
> 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(-)
Yes, this patch is easily tranferred.
Reviewed-by: Michal Koutný <mkoutny@suse.com>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model
2026-09-26 20:44 [LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model Sebastian Chlad
2026-09-26 20:44 ` [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the " Sebastian Chlad
2026-09-26 20:44 ` [LTP] [PATCH 2/2] memcg/memcontrol0[34]: Remove protection from the top level group Sebastian Chlad
@ 2026-09-30 18:36 ` Cyril Hrubis
2 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2026-09-30 18:36 UTC (permalink / raw)
To: Sebastian Chlad; +Cc: Sebastian Chlad, ltp
Hi!
I've pushed this as a last fixes before the release. Thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-09-30 18:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-26 20:44 [LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model Sebastian Chlad
2026-09-26 20:44 ` [LTP] [PATCH 1/2] memcg/memcontrol0[34]: Use expected values from the " Sebastian Chlad
2026-09-28 6:27 ` Wei Gao via ltp
2026-09-29 7:06 ` [LTP] " linuxtestproject.agent
2026-09-30 15:04 ` [LTP] [PATCH 1/2] " Michal Koutný via ltp
2026-09-26 20:44 ` [LTP] [PATCH 2/2] memcg/memcontrol0[34]: Remove protection from the top level group Sebastian Chlad
2026-09-28 6:31 ` Wei Gao via ltp
2026-09-30 15:04 ` Michal Koutný via ltp
2026-09-30 18:36 ` [LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.