The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>,
	linux-kernel@vger.kernel.org, kernel-team@meta.com,
	Bradley Morgan <include@grrlz.net>
Subject: Re: [PATCH v2] workqueue: annotate racy p->wake_cpu accesses in kick_pool_pick()
Date: Wed, 12 Aug 2026 08:25:28 -1000	[thread overview]
Message-ID: <90e44e95a0b95c74dfb260a335ab0fea@kernel.org> (raw)
In-Reply-To: <20260811-wq_race_kick-v2-1-6e66ff12d8ae@debian.org>

Hello, Breno.

On Tue, Aug 11, 2026 at 02:55:56AM -0700, Breno Leitao wrote:
> The race is harmless, this patch only acknowledge that this is racy and
> it is fine, silenting KCSAN.

Can you say why it's harmless? wake_cpu is a best-effort placement hint.
Every writer stores a valid CPU id and the wakeup path validates it
through select_task_rq(), so a racy value only affects where the worker
wakes up. Also, s/acknowledge/acknowledges/ and s/silenting/silencing/.

> -	if (!pool->attrs->affn_strict &&
> -	    !cpumask_test_cpu(p->wake_cpu, pool->attrs->__pod_cpumask)) {
> +	bool wake_cpu_in_pod = cpumask_test_cpu(READ_ONCE(p->wake_cpu),
> +						pool->attrs->__pod_cpumask);
> +
> +	if (!pool->attrs->affn_strict && !wake_cpu_in_pod) {

The hoist drops the !affn_strict short-circuit and adds a declaration
after statements. Can you keep the test inline in the condition?

	if (!pool->attrs->affn_strict &&
	    !cpumask_test_cpu(READ_ONCE(p->wake_cpu),
			      pool->attrs->__pod_cpumask)) {

Thanks.

-- 
tejun

      reply	other threads:[~2026-08-12 18:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  9:55 [PATCH v2] workqueue: annotate racy p->wake_cpu accesses in kick_pool_pick() Breno Leitao
2026-08-12 18:25 ` Tejun Heo [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=90e44e95a0b95c74dfb260a335ab0fea@kernel.org \
    --to=tj@kernel.org \
    --cc=include@grrlz.net \
    --cc=jiangshanlai@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@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