Re: [PATCH v2] workqueue: annotate racy p->wake_cpu accesses in kick_pool_pick()

From: Tejun Heo

Date: Wed Aug 12 2026 - 14:28:18 EST


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