Hi Waiman. On Sun, Apr 06, 2025 at 09:41:58PM -0400, Waiman Long <[email protected]> wrote: ... > diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c > b/tools/testing/selftests/cgroup/test_memcontrol.c > index 16f5d74ae762..bab826b6b7b0 100644 > --- a/tools/testing/selftests/cgroup/test_memcontrol.c > +++ b/tools/testing/selftests/cgroup/test_memcontrol.c
I'd suggest updating also the header of the test for clarity and then
exempt the Child 2 ('E') conditionally from comparisons, something like:
@@ -380,10 +380,10 @@ static bool reclaim_until(const char *memcg, long goal);
*
* Then it checks actual memory usages and expects that:
* A/B memory.current ~= 50M
- * A/B/C memory.current ~= 29M
- * A/B/D memory.current ~= 21M
- * A/B/E memory.current ~= 0
- * A/B/F memory.current = 0
+ * A/B/C memory.current ~= 29M, memory.events:low > 0
+ * A/B/D memory.current ~= 21M, memory.events:low > 0
+ * A/B/E memory.current ~= 0, memory.events:low not specified (==0 w/out
memory_recursiveprot)
+ * A/B/F memory.current = 0, memory.events:low == 0
* (for origin of the numbers, see model in memcg_protection.m.)
*
* After that it tries to allocate more than there is
@@ -527,6 +527,7 @@ static int test_memcg_protection(const char *root, bool min)
for (i = 0; i < ARRAY_SIZE(children); i++) {
int no_low_events_index = 1;
+ int ignore_low_events_index = has_recursiveprot ? 2 : -1;
long low, oom;
oom = cg_read_key_long(children[i], "memory.events", "oom ");
@@ -534,6 +535,8 @@ static int test_memcg_protection(const char *root, bool min)
if (oom)
goto cleanup;
+ if (i == ignore_low_events_index)
+ continue;
if (i <= no_low_events_index && low <= 0)
goto cleanup;
if (i > no_low_events_index && low)
signature.asc
Description: PGP signature

