From: Tao Cui <cui.tao@linux.dev>
To: guojian <guojian@kylinos.cn>,
tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com,
shuah@kernel.org
Cc: cui.tao@linux.dev, cgroups@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH] selftests/cgroup: Remove redundant cg_enter_current() call in test_core
Date: Fri, 17 Jul 2026 20:51:58 +0800 [thread overview]
Message-ID: <274129a4-88cd-49d4-9148-5112a8ac59e3@linux.dev> (raw)
In-Reply-To: <20260717110606.298368-1-guojian@kylinos.cn>
在 2026/7/17 19:06, guojian 写道:
> From: Jian Guo <guojian@kylinos.cn>
>
> The test_cgcore_no_internal_process_constraint_on_threads test has two
> back-to-back cg_enter_current(root) calls in its cleanup path.
>
> A single cg_enter_current() call atomically migrates the entire thread
> group to the target cgroup even for multi-threaded processes, and this
> test creates no extra threads or child processes that would require a
> second migration attempt. The second call is a harmless no-op once the
> process is already in the root cgroup, but it is redundant and
> inconsistent with the cleanup logic used in all other cgroup core
> selftest cases.
>
> Remove the duplicate call to clean up the code. No functional change is
> intended.
>
> Signed-off-by: Jian Guo <guojian@kylinos.cn>
> ---
> tools/testing/selftests/cgroup/test_core.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/tools/testing/selftests/cgroup/test_core.c b/tools/testing/selftests/cgroup/test_core.c
> index 88ca832d4fc1..8e3f9b391e44 100644
> --- a/tools/testing/selftests/cgroup/test_core.c
> +++ b/tools/testing/selftests/cgroup/test_core.c
> @@ -426,7 +426,6 @@ static int test_cgcore_no_internal_process_constraint_on_threads(const char *roo
> ret = KSFT_PASS;
>
> cleanup:
> - cg_enter_current(root);
> cg_enter_current(root);
> if (child)
> cg_destroy(child);
Ran test_core on x86_64 (cgroup v2, all controllers available),
12/12 pass, 0 fail, 0 skip — output byte-identical before and
after the patch. Confirms the removed call is a no-op.
Acked-by: Tao Cui <cuitao@kylinos.cn>
Thanks,
Tao
next prev parent reply other threads:[~2026-07-17 12:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 11:06 [PATCH] selftests/cgroup: Remove redundant cg_enter_current() call in test_core guojian
2026-07-17 12:51 ` Tao Cui [this message]
2026-07-17 15:30 ` Tao Cui
2026-07-17 14:23 ` Michal Koutný
2026-07-17 17:23 ` Tejun Heo
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=274129a4-88cd-49d4-9148-5112a8ac59e3@linux.dev \
--to=cui.tao@linux.dev \
--cc=cgroups@vger.kernel.org \
--cc=guojian@kylinos.cn \
--cc=hannes@cmpxchg.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox