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

[email protected] Tue, 4 Aug 2026 10:41:58 +0000
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
Hi Pavithra,

On Aug 4, 2026, Pavithra wrote:
> 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.

> 	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

>  * Two child cgroups (group_a, group_b) are created under the test cgroup.
>  * A worker process is placed in group_a and 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?

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp