mirror of https://lore.kernel.org/lkml/
 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: Mon, 30 Mar 2026 10:09:46 -1000	[thread overview]
Message-ID: <acrYisNNAv2FEgXP@slm.duckdns.org> (raw)
In-Reply-To: <20260330143629.GP3738010@noisy.programming.kicks-ass.net>

Hello, Peter.

On Mon, Mar 30, 2026 at 04:36:29PM +0200, Peter Zijlstra wrote:
> > 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?
> 
> Perhaps a try_to_wake_up() variant that takes a cpumask (see the
> completely untested code below). But I'm not entirely sure. The current
> thing very much relies on a bunch of implementation details that aren't
> guaranteed.
> 
> The below will 'fake' the task cpumask for a while; and note that the
> caller has to be careful to provide a mask that only includes tasks that
> were set in the current task, otherwise 'funny' things will happen.
> Also, it will only use this mask if it ends up doing CPU selection at
> all.
> 
> Ooh, I suppose I should make sure wake_cpu is inside the provided map
> too...

Does it need to be? I think all select_task_rq() implementations ignore it
if it's outside allowed. I think all we'd need is cpumask_subset() test to
reject (and trigger WARN_ON_ONCE()) if the preferred mask is not within the
allowed.

Thanks.

-- 
tejun

  reply	other threads:[~2026-03-30 20:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27  7:30 Yu Peng
2026-03-27  9:27 ` Peter Zijlstra
2026-03-27 17:04   ` Tejun Heo
2026-03-30 14:36     ` Peter Zijlstra
2026-03-30 20:09       ` Tejun Heo [this message]
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=acrYisNNAv2FEgXP@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome