From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADC2B44606A for ; Mon, 10 Aug 2026 19:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786391459; cv=none; b=ckYoz++KGsOhQktljCDuUQONYoa7tlFQXD0dRo0YeOV+Tui4w/sbpoROr6iwVMzeaAux7W2TnCYbHN6r9o5VO/OsyLRHTG3HZ1yGLhaDEJUYcJhwRr6vD4XMsRM+cnC2JSo7To8A14huwJP0YMwT64PPoeruPErW9eMEC1WfIzI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786391459; c=relaxed/simple; bh=DRA7ThoxpJyaWXnRx54qZIGyhQ9FXCW4ggYsYYvjyQ0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=T+aWpAm+eZjxB3EL88tPv0JRLWf425gGPkgbXgjhfjmTHvjGibv6xgyl4WwAygny4Yi2WnEv+W507mIqCGL0/tNXTKEcHT+RLmfjsPQlNPkRrFEreSuy5wDWvcw2BTXnLI5VQ/aGy00mhr6yTUV+V7b4FKcraKyunf6bQl9EPcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gn/TpVjO; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gn/TpVjO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16EC01F000E9; Mon, 10 Aug 2026 19:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786391458; bh=4xHA8yJy6pmol9FJfsxjynHOTbkyQ9nOLV28Z8lmjKA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Gn/TpVjOTxCEvLp+ReqKFJy1xZaCApsNJZVyNMl/N+RCqjTkrCC0SRvJgnJYvfJVq qKZgicCEHFR+QSq/6jUhZvbfHyCPAthM0mUjFRp1+KlsNWofbbgbGfa01H3LP8xuCM 9alBP4sIVUa0mp9RYfiK6JY2xOGbmSpORax+7w30hqpGobbb/4YyfGWlJY3VTjdpKY 6KB+RvarnJ7X/b9fwacTja8R8mlD4BE0hS5Ig/zF/UEWbqtBUW0eLftNizlnx/uhyJ LBxzrAQTEN7i7g0pXCC5JGLspyOpmd9y8T2pY6YyeYWTs3aocbIkfSKNE68oHgDyRm fLHjk+4+eeiBw== Date: Mon, 10 Aug 2026 09:50:57 -1000 From: Tejun Heo To: Breno Leitao Cc: Lai Jiangshan , linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH] workqueue: read p->wake_cpu once in kick_pool_pick() Message-ID: References: <20260805-wq_race_kick-v1-1-d55adc12416b@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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