mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Wenwu Hou <hwenwur@gmail.com>,
	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: Wed, 25 Nov 2026 17:24:34 +0100	[thread overview]
Message-ID: <awcLwio_qyE3d1bL@localhost.localdomain> (raw)
In-Reply-To: <20261125103822.2129a7ec@gandalf.local.home>

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(&current->pi_lock, flags);
> > > +		current->flags &= ~PF_NO_SETAFFINITY;
> > > +		raw_spin_unlock_irqrestore(&current->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.

-- 
Frederic Weisbecker
SUSE Labs

      reply	other threads:[~2026-11-25 16:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  8:46 Wenwu Hou
2026-11-25 13:37 ` Frederic Weisbecker
2026-11-25 15:38   ` Steven Rostedt
2026-11-25 16:24     ` Frederic Weisbecker [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=awcLwio_qyE3d1bL@localhost.localdomain \
    --to=frederic@kernel.org \
    --cc=hwenwur@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®