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

Tejun Heo <[email protected]>
Newsgroups org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.