memcg/memcontrol05: add cgroup v2 task migration charge accounting test
PATCH 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.
--- runtest/controllers | 1 + testcases/kernel/controllers/memcg/.gitignore | 1 + .../kernel/controllers/memcg/memcontrol05.c | 160 ++++++++++++++++++ 3 files changed, 162 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 +160 -0
160 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 11 lines · Pavithra
memcg/memcontrol05: add cgroup v2 task migration charge accounting test
buf1 = SAFE_MMAP(NULL, ALLOC_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); TST_CHECKPOINT_WAKE(WORKER_ALLOC_DONE); [...] buf2 = SAFE_MMAP(NULL, ALLOC_SIZE2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); TST_CHECKPOINT_WAKE(WORKER_ALLOC2_DONE);
Could these mappings be populated by explicitly writing one byte per page, and could the test declare an appropriate .min_mem_avail requirement?
mmap(2) states that mmap() does not fail when MAP_POPULATE cannot populate the whole mapping. Linux 7.2 also discards mm_populate() errors. Under memory pressure, the parent can therefore report TFAIL for an incomplete allocation even though cgroup migration accounting is correct. The test needs 80 MB, but currently has no memory prerequisite to turn that condition into TCONF.
Quoted 3 lines
pid_t pid; long baseline_b, after_migrate, after_alloc2, current_a; worker_resumed = false;
Could a blank line be added after the declarations? check-memcontrol05 reports:
memcontrol05.c:80: WARNING: Missing a blank line after declarations
Quoted 6 lines
* Two child cgroups (
group_a,group_b) are created under the test cgroup.
* A worker process is placed ingroup_aand allocates a known amount of
[...]
* group_b/cgroup.procs. In cgroup v2 memory charges are never
[...]
* that allocated them. group_b/memory.current must not increase
Could identifiers and file names in this exported RST block use double backticks as required for inline literals?
Quoted 1 line
.needs_root = 1,
Could the description also state why root is required? Root-only tests must document the reason; here it is needed to create cgroups and move the worker through cgroup.procs.
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