Re: [PATCH] workqueue: read p->wake_cpu once in kick_pool_pick()

From: Tejun Heo

Date: Mon Aug 10 2026 - 15:54:26 EST


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