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
Subject: Re: [PATCH] workqueue: read p->wake_cpu once in kick_pool_pick()
Date: Mon, 10 Aug 2026 09:50:57 -1000 [thread overview]
Message-ID: <anoroQ1IxX94STnH@slm.duckdns.org> (raw)
In-Reply-To: <20260805-wq_race_kick-v1-1-d55adc12416b@debian.org>
On Wed, Aug 05, 2026 at 04:17:48AM -0700, Breno Leitao wrote:
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 26d5680c751c6..333752ac38298 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -1308,8 +1308,10 @@ static bool kick_pool_pick(struct worker_pool *pool, struct task_struct **wakep)
> * If @pool has non-strict affinity, @worker might have ended up outside
> * its affinity scope. Repatriate.
> */
> - 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) {
Can you update the p->wake_cpu assignement several lines below to
WRITE_ONCE() too?
Thanks.
--
tejun
next prev parent reply other threads:[~2026-08-10 19:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 11:17 [PATCH] workqueue: read p->wake_cpu once in kick_pool_pick() Breno Leitao
2026-08-05 18:42 ` Bradley Morgan
2026-08-10 19:50 ` Tejun Heo [this message]
2026-08-11 9:28 ` Breno Leitao
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=anoroQ1IxX94STnH@slm.duckdns.org \
--to=tj@kernel.org \
--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