From: Steven Rostedt <rostedt@goodmis.org>
To: sashiko-bot@kernel.org
Cc: sashiko-reviews@lists.linux.dev, "Wenwu Hou" <hwenwur@gmail.com>,
linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing/hwlat: Bind the sampler kthread instead of setting its affinity
Date: Tue, 24 Nov 2026 21:20:11 -0500 [thread overview]
Message-ID: <20261124212011.5862dca6@robin> (raw)
In-Reply-To: <sashiko-outbox-208125@kernel.org>
On Wed, 11 Nov 2026 02:54:09 +0000
sashiko-bot@kernel.org wrote:
> [Severity: Medium]
> Does leaving PF_NO_SETAFFINITY set on hwlatd prevent userspace from
> changing its CPU affinity or moving it into a cgroup?
>
> kthread_bind_mask() sets PF_NO_SETAFFINITY, which kthread() only checks on
> initial wake-up before calling kthread_fn(). Because kthread_fn() never
> clears the flag, sched_setaffinity() and cgroup_attach_permissions()
> reject hwlatd with -EINVAL in both round-robin and none modes. That also
> makes the user-affinity override check in move_to_next_cpu() unreachable
> from sched_setaffinity():
>
> kernel/trace/trace_hwlat.c:move_to_next_cpu() {
> /*
> * If for some reason the user modifies the CPU affinity
> * of this thread, then stop migrating for the duration
> * of the current test.
> */
> if (!cpumask_equal(current_mask, current->cpus_ptr))
> goto change_mode;
> ...
> }
>
> Clearing PF_NO_SETAFFINITY in kthread_fn() once the thread has started, as
> done in 4998e7fda149 ("tracing/osnoise: Switch from PF_NO_SETAFFINITY to
> migrate_disable"), would avoid this regression while still skipping
> kthread_affine_node() on the initial wake-up.
I agree with Sashiko. Please update and send a new version.
Thanks,
-- Steve
prev parent reply other threads:[~2026-11-25 2:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 2:07 [PATCH] tracing/hwlat: Bind the sampler kthread instead of setting its affinity Wenwu Hou
2026-11-11 2:54 ` sashiko-bot
2026-11-25 2:20 ` Steven Rostedt [this message]
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=20261124212011.5862dca6@robin \
--to=rostedt@goodmis.org \
--cc=hwenwur@gmail.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.