Skip to contentSkip to conversation

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

PATCH Superseded Pavithra 2 participants 2 messages Aug 13

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Pavithra

author
#0 lore raw

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
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 +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
#1 lore raw

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