[LTP] [PATCH 0/2] memcg/memcontrol0[34]: Align with the kselftest protection model

Sebastian Chlad sebastianchlad@gmail.com
Sat Sep 26 22:44:52 CEST 2026


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



More information about the ltp mailing list