memcg/memcontrol05: add cgroup v2 task migration charge accounting test
PATCH v3 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.
---
v2 -> v3:
- Increased MIN_MEM_AVAIL from 80 to 128 to add headroom for page tables and kernel overhead.
- Added verification that group_a retains its charges after task migration
to group_b.
Link to v2: https://lore.kernel.org/ltp/[email protected]/
--- runtest/controllers | 1 + testcases/kernel/controllers/memcg/.gitignore | 1 + .../kernel/controllers/memcg/memcontrol05.c | 181 ++++++++++++++++++ 3 files changed, 183 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 +181 -0
181 lines not on this page · raw message
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Pavithra,
Quoted 6 lines · Pavithra
memcg/memcontrol05: add cgroup v2 task migration charge accounting test
group_a = tst_cg_group_mk(tst_cg, "group_a"); group_b = tst_cg_group_mk(tst_cg, "group_b"); SAFE_CG_SCANF(group_b, "memory.current", "%ld", &baseline_b);
Could the test disable swapping for both child cgroups before starting the worker? Touching the pages only makes them resident at that instant. Under memory pressure, group_a pages can be swapped between the checkpoint and the reads, so memory.current drops while the charge remains correctly associated with group_a in memory.swap.current. The same race affects the group_b delta after the second allocation and can produce a false failure.
Setting memory.swap.max to 0, or otherwise keeping the pages resident, would make the memory.current assertions measure migration accounting reliably.
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