Skip to contentSkip to conversation

memcg/memcontrol05: add cgroup v2 task migration charge accounting test

PATCH Superseded Pavithra 2 participants 2 messages Aug 13

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Pavithra

author
#0 lore raw

PATCH v5 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.

---
v4 -> v5:
guard memory.swap.max writes with SAFE_CG_HAS
link to v4: https://lore.kernel.org/ltp/[email protected]/

---
 runtest/controllers                           |   1 +
 testcases/kernel/controllers/memcg/.gitignore |   1 +
 .../kernel/controllers/memcg/memcontrol05.c   | 186 ++++++++++++++++++
 3 files changed, 188 insertions(+)
 create mode 100644 testcases/kernel/controllers/memcg/memcontrol05.c
runtest/controllers +1 -0
index 93c52c439..a9050ef0e 100644
@@ -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
index 3883cede6..8b9f6005c 100644
@@ -9,3 +9,4 @@ memcontrol01
 memcontrol02
 memcontrol03
 memcontrol04
+memcontrol05
testcases/kernel/controllers/memcg/memcontrol05.c new file +186 -0

186 lines not on this page · raw message

Signature · 5 lines
2.55.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Pavithra,

Quoted 9 lines · Pavithra

memcg/memcontrol05: add cgroup v2 task migration charge accounting test

static void cleanup(void)

{
	if (group_a)
		group_a = tst_cg_group_rm(group_a);
	if (group_b)
		group_b = tst_cg_group_rm(group_b);
}

Could cleanup first release and reap a worker that may still be blocked on WORKER_RESUME or WORKER_EXIT?

Any SAFE_* failure after SAFE_FORK() enters cleanup while the worker is still in one of these cgroups. tst_cg_group_rm() then fails to remove the populated cgroup. After the framework kills the worker, tst_cg_cleanup() still cannot remove the test cgroup because the child cgroup directories remain. Tracking whether the worker was started and waking or terminating and reaping it here, as memcontrol03/04 do, would allow the cgroups to be removed on fatal paths.

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