From: Wenwu Hou <hwenwur@gmail.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] tracing/hwlat: Bind the sampler kthread instead of setting its affinity
Date: Thu, 26 Nov 2026 17:16:42 +0800 [thread overview]
Message-ID: <awf4-hjPFkBxPUev@gmail.com> (raw)
In-Reply-To: <awcLwio_qyE3d1bL@localhost.localdomain>
On Wed, Nov 25, 2026 at 05:24:34PM +0100, Frederic Weisbecker wrote:
> Le Wed, Nov 25, 2026 at 10:38:22AM -0500, Steven Rostedt a écrit :
> > On Wed, 25 Nov 2026 14:37:24 +0100
> > Frederic Weisbecker <frederic@kernel.org> wrote:
> >
> > > > static int kthread_fn(void *data)
> > > > {
> > > > + unsigned long flags;
> > > > u64 interval;
> > > >
> > > > + /*
> > > > + * kthread_bind_mask() sets PF_NO_SETAFFINITY to keep the initial
> > > > + * affinity from being overridden by kthread_affine_node(). Clear it
> > > > + * now to allow userspace affinity changes and cgroup migration, but
> > > > + * keep per-CPU threads bound to their CPUs.
> > > > + */
> > > > + if (hwlat_data.thread_mode != MODE_PER_CPU) {
> > > > + raw_spin_lock_irqsave(¤t->pi_lock, flags);
> > > > + current->flags &= ~PF_NO_SETAFFINITY;
> > > > + raw_spin_unlock_irqrestore(¤t->pi_lock, flags);
> > >
> > > This is not pretty but moreover, is it a good idea to let the user override
> > > that affinity?
> >
> > No, but we used to. Perhaps we should make that not possible instead? :-/
>
> Right, the affinity should only be changed by the kernel if tracing_cpumask is
> written. Otherwise it doesn't seem to make sense to let the user play with the
> affinity.
I agree. Perhaps v1 is better.
> --
> Frederic Weisbecker
> SUSE Labs
next prev parent reply other threads:[~2026-11-26 9:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:46 [PATCH v2] tracing/hwlat: Bind the sampler kthread instead of setting its affinity Wenwu Hou
2026-11-25 13:37 ` Frederic Weisbecker
2026-11-25 15:38 ` Steven Rostedt
2026-11-25 16:24 ` Frederic Weisbecker
2026-11-26 9:16 ` Wenwu Hou [this message]
2026-11-27 16:00 ` Steven Rostedt
2026-11-30 2:12 ` Wenwu Hou
2026-11-30 16:49 ` Steven Rostedt
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=awf4-hjPFkBxPUev@gmail.com \
--to=hwenwur@gmail.com \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=stable@vger.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 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.