memcg/memcontrol05: add cgroup v2 task migration charge accounting test
PATCH v4 1/1 memcg/memcontrol05: add cgroup v2 task migration charge accounting test
Verify that in cgroup v2, memory charges remain pinned to the cgroup that allocated them when a task migrates, and that new allocations after migration are charged to the destination cgroup.
---
v3 -> v4:
- disable swap on group_a and group_b to prevent false failures from memory.current drops under pressure
Link to v3: https://lore.kernel.org/ltp/[email protected]/
--- runtest/controllers | 1 + testcases/kernel/controllers/memcg/.gitignore | 1 + .../kernel/controllers/memcg/memcontrol05.c | 184 ++++++++++++++++++ 3 files changed, 186 insertions(+) create mode 100644 testcases/kernel/controllers/memcg/memcontrol05.c
runtest/controllers +1 -0
@@ -24,6 +24,7 @@ memcontrol01 memcontrol01 memcontrol02 memcontrol02 memcontrol03 memcontrol03 memcontrol04 memcontrol04 +memcontrol05 memcontrol05 cgroup_fj_function_debug cgroup_fj_function.sh debug cgroup_fj_function_cpuset cgroup_fj_function.sh cpuset
testcases/kernel/controllers/memcg/.gitignore +1 -0
@@ -9,3 +9,4 @@ memcontrol01 memcontrol02 memcontrol03 memcontrol04 +memcontrol05
testcases/kernel/controllers/memcg/memcontrol05.c new file +184 -0
184 lines not on this page · raw message
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Pavithra,
testcases/kernel/controllers/memcg/memcontrol05.c line 100
Quoted 4 lines · Pavithra
memcg/memcontrol05: add cgroup v2 task migration charge accounting test
testcases/kernel/controllers/memcg/memcontrol05.c new file +2
-0+SAFE_CG_PRINT (group_a,"memory.swap.max" ,"0" ); +SAFE_CG_PRINT (group_b,"memory.swap.max" ,"0" );
Could these writes be guarded with SAFE_CG_HAS()? Linux 7.2 registers the cgroup swap files only when CONFIG_SWAP is enabled, but the memory controller and migration behavior remain available without it. On a CONFIG_SWAP=n kernel, the first SAFE_CG_PRINT() therefore reports TBROK instead of running the test. When swap support is absent, skipping these writes is sufficient because anonymous memory cannot be swapped.
Verdict - Needs revision
---
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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp