All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Yu Peng <pengyu@kylinos.cn>,
	mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, jiangshanlai@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched,workqueue: Use READ_ONCE()/WRITE_ONCE() for wake_cpu accesses
Date: Fri, 27 Mar 2026 07:04:20 -1000	[thread overview]
Message-ID: <aca4lM-AsEdstYCf@slm.duckdns.org> (raw)
In-Reply-To: <20260327092739.GB3739027@noisy.programming.kicks-ass.net>

Hello,

On Fri, Mar 27, 2026 at 10:27:39AM +0100, Peter Zijlstra wrote:
> On Fri, Mar 27, 2026 at 03:30:07PM +0800, Yu Peng wrote:
> > task_struct->wake_cpu is used as a wake placement hint by scheduler code
> > and workqueue's non-strict affinity repatriation path.
> > 
> > These accesses are intentionally lockless and stale values are tolerated,
> > affecting only wakeup placement. 
> 
> The scheduler usage isn't lockless. And I'm not at all sure why and how
> workqueue is poking at this stuff :/ It has no business poking at it.

Oh, you were involved in the discussion. It's workqueue using ->wake_cpu as
a way to implement opportunistic affinity at work boundaries as past history
doesn't mean anything at these boundaries.

 https://lore.kernel.org/all/20230519001709.2563-1-tj@kernel.org/

Hmmm... it would trigger KCSAN. Maybe a better way to do it is exposing
sched interface that does WRITE_ONCE wrapping? How do you want it resolved?

Thanks.

-- 
tejun

  reply	other threads:[~2026-03-27 17:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27  7:30 [PATCH] sched,workqueue: Use READ_ONCE()/WRITE_ONCE() for wake_cpu accesses Yu Peng
2026-03-27  9:27 ` Peter Zijlstra
2026-03-27 17:04   ` Tejun Heo [this message]
2026-03-30 14:36     ` Peter Zijlstra
2026-03-30 20:09       ` Tejun Heo
2026-03-30 20:26         ` 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=aca4lM-AsEdstYCf@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jiangshanlai@gmail.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=pengyu@kylinos.cn \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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.