Hi Wei,
On Sun, 07 Jun 2026 04:52:06 +0000, Wei Gao wrote:
> mmapstress06: Convert to new API
> +static void cleanup(void)
> +{
> + if (child_pid > 0) {
> + SAFE_KILL(child_pid, SIGKILL);
> + SAFE_WAITPID(child_pid, NULL, 0);
> + }
> +
> + if (cg_child) {
> + SAFE_CG_PRINTF(tst_cg_drain, "cgroup.procs", "%d", getpid());
> + cg_child = tst_cg_group_rm(cg_child);
> + }
> +}
The drain step moves the parent process into tst_cg_drain, but the
parent was never placed into cg_child -- only the forked child was
(via SAFE_CG_PRINTF(cg_child, "cgroup.procs", ...) inside the child
block). After SAFE_KILL + SAFE_WAITPID, the child has exited and the
kernel has already removed it from cg_child, so the cgroup is empty
and tst_cg_group_rm() can be called directly.
Draining the parent out of its current cgroup (tst_cg, managed by the
framework) into tst_cg_drain leaves the test process in the wrong
cgroup after cleanup. Compare with ksm02.c, where the drain is correct
because the parent explicitly moves itself into a child cgroup first.
The fix is to drop the SAFE_CG_PRINTF(tst_cg_drain, ...) line:
if (cg_child)
cg_child = tst_cg_group_rm(cg_child);
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.