From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 71B7B2C11D7 for ; Fri, 27 Mar 2026 17:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774631062; cv=none; b=CQq50KPsNya/cuff4MRG5I1OFMNqfnU86XJbiw7qEQqC53a9DBP/BkeghE+PRraJThbVO3/PX5E0G8gSEF8fRBxORobrAI8pOPGbinmMmM74WUxHyPbOdIY4CDINQwIyGHPy0h1HwGk4dGNoBI3qicgMrO/9B/NJES8ELEKmvKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774631062; c=relaxed/simple; bh=ZUSrCKtt5bHJ/3l9QFgezPy9ebCoc/fIXkoatfSKdtE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RlDLpUujD1D1QCXEQC0uHMCgxFspvQkBtOr7TluTmv10zE7hUPIzY2XMUOO3fXauDq8l4hLf3pTIp/RtgIDJJxUa7z1pmFJ/uAGu0ADr5cffDNsKuE2XwUu21i6lnMIwD1yQs+l0JyN7SnhFvMivnW7Rv8PKYhUnFBxUMpgnTXU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WsaxEUxG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WsaxEUxG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2ECAC19423; Fri, 27 Mar 2026 17:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774631062; bh=ZUSrCKtt5bHJ/3l9QFgezPy9ebCoc/fIXkoatfSKdtE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WsaxEUxGnDe7c2kqlhnKcc02YNVd3EeVMlW33apEtHofOojwu60FO1ZVacr8skwe6 NKcRes6ahrVDC9DiQ/KZkRd43FVh041HJpPv3uqA8DSjkVnOUTa4euAfl6j0d6Mbv4 Hmdg0o/Gp3N4DLsUD1kUWHyf1iE/BYXeSXcQTTSgdqMCiF1WGsraTVTQ+mERWR0kmY ds8xmH+nUopNn2eOVrRCCXzHMxfhgDcdi/co3GrX/Lbw3BXuTilurq05rTW54Yn5wU 4vRe8H873YC7Qjhrjuxf6VzpLHMMmZ2ri/8rW7d9wTig9o7c0m3dIixV2tPfo0yQfA gFbu3zMVziAoA== Date: Fri, 27 Mar 2026 07:04:20 -1000 From: Tejun Heo To: Peter Zijlstra Cc: Yu Peng , mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, jiangshanlai@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched,workqueue: Use READ_ONCE()/WRITE_ONCE() for wake_cpu accesses Message-ID: References: <20260327073007.254673-1-pengyu@kylinos.cn> <20260327092739.GB3739027@noisy.programming.kicks-ass.net> 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: <20260327092739.GB3739027@noisy.programming.kicks-ass.net> Hello, On Fri, Mar 27, 2026 at 10:27:39AM +0100, Peter Zijlstra wrote: > On Fri, Mar 27, 2026 at 03:30:07PM +0800, Yu Peng wrote: > > task_struct->wake_cpu is used as a wake placement hint by scheduler code > > and workqueue's non-strict affinity repatriation path. > > > > These accesses are intentionally lockless and stale values are tolerated, > > affecting only wakeup placement. > > The scheduler usage isn't lockless. And I'm not at all sure why and how > workqueue is poking at this stuff :/ It has no business poking at it. Oh, you were involved in the discussion. It's workqueue using ->wake_cpu as a way to implement opportunistic affinity at work boundaries as past history doesn't mean anything at these boundaries. https://lore.kernel.org/all/20230519001709.2563-1-tj@kernel.org/ Hmmm... it would trigger KCSAN. Maybe a better way to do it is exposing sched interface that does WRITE_ONCE wrapping? How do you want it resolved? Thanks. -- tejun