All of lore.kernel.org
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] mmapstress06: Convert to new API
Date: Sun,  7 Jun 2026 08:02:12 +0000	[thread overview]
Message-ID: <20260607080212.3930-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260607045219.32729-1-wegao@suse.com>

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

  reply	other threads:[~2026-06-07  8:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 11:59 [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space Wei Gao via ltp
2026-04-27 12:26 ` Li Wang
2026-04-27 13:57   ` Wei Gao via ltp
2026-04-28  1:39     ` Li Wang
2026-04-27 13:57 ` [LTP] " linuxtestproject.agent
2026-04-28 11:52 ` [LTP] [PATCH v1] " Andrea Cervesato via ltp
2026-04-28 12:58 ` Petr Vorel
2026-04-28 16:34   ` Petr Vorel
2026-04-29  2:22     ` Wei Gao via ltp
2026-04-29  6:10       ` Petr Vorel
2026-04-30  8:01       ` Li Wang
2026-06-05  4:29 ` [LTP] [PATCH v2] mmapstress06: Convert to new API Wei Gao via ltp
2026-06-05  5:28   ` [LTP] " linuxtestproject.agent
2026-06-05  7:11     ` Li Wang
2026-06-05  7:17   ` [LTP] [PATCH v2] " Andrea Cervesato via ltp
2026-06-05  9:35     ` Wei Gao via ltp
2026-06-05  9:42       ` Andrea Cervesato via ltp
2026-06-05 10:02         ` Wei Gao via ltp
2026-06-06 10:08   ` [LTP] [PATCH v3] " Wei Gao via ltp
2026-06-06 11:32     ` [LTP] " linuxtestproject.agent
2026-06-07  4:52     ` [LTP] [PATCH v4] " Wei Gao via ltp
2026-06-07  8:02       ` linuxtestproject.agent [this message]
2026-06-08  2:52       ` [LTP] [PATCH v5] " Wei Gao via ltp
2026-06-08  4:51         ` [LTP] " linuxtestproject.agent
2026-06-10  2:26         ` [LTP] [PATCH v5] " Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260607080212.3930-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=ltp@lists.linux.it \
    --cc=wegao@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.