Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2462098rdb; Wed, 15 Nov 2023 01:05:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoSlByFlySK8tnHVaDVSwt1AfCiut919ko6xJwJj+w+0px981IaCe1252nWz9Tcv1BcWNa X-Received: by 2002:a17:902:8f98:b0:1cc:54b5:b4d9 with SMTP id z24-20020a1709028f9800b001cc54b5b4d9mr3882908plo.52.1700039139587; Wed, 15 Nov 2023 01:05:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700039139; cv=none; d=google.com; s=arc-20160816; b=E4p0RRwagPt6N4Not0Smrx6xmN9oT0PsL2l1T4icuadvcIOy1xEiHPV/txK5g6U0Pv k5ss+2cvOKxORiPUB6ZW2Y8eTFERXwBhucURNUnUsD0zVpirj9Y4wNrYtcXrISSB2dyr 6k93Aql7IiU/FIba8P4zZrNYKsvwAPBFciKaq5WFCURd/k7sc8w8H6MefAh5lPm7gw8U Q43I6QvCxSfh9Nl6mz1iaf2Ugg1I/bC21NvBrla+UP70/Ft08UCuUqEGj8KfSQ3xPsul pjmzEUKxMNZFPSHRzd0C7Exp6tQ28ZQM4r6Gut+0xOje+EBHD7dVBIVpmjiuLre7PRch 058w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=RLOytOKGBnb6B6iJmpeTnDki+l9w/n1XwObQHovifBs=; fh=7M8a4xo2dYp6D9f01nJgDrAIFgcq/515G7GEcZ11io0=; b=q4615mKy/khtGZRIPtYk3aZGyDJ4Vn1aJRrwXV11APOGKgptiGM10y/LSbRxLg1vEo cU/pK+wlZBwbWGRynJ3O49rLaMo6foPLtOvnFSFC60EJc+CR0BEokAiEqC99D/O4bRRt Fg7ETeOK4XpoDBAfQykJe8C0QWzx5m51oDIRfxe0RS+h5QMeKihTdeGO0F3ynY6lNESY F9z+86Ms5R2QeNoRmJe+smcitGpjs9Txv5P0CSDCTPBQSvpayOkl3uT/5o4D6qkdCwNf id7HPTJjJ44TeV/w1szuwVn03rAjhiS2XCJHrhAUalrR734HgSWPjOCo5We5vybZ85D3 1E6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PrzolQA+; dkim=neutral (no key) header.i=@linutronix.de header.b=igLiwJk5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j3-20020a170903028300b001cc40f05f1csi10123980plr.519.2023.11.15.01.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 01:05:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PrzolQA+; dkim=neutral (no key) header.i=@linutronix.de header.b=igLiwJk5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 71EB48138984; Wed, 15 Nov 2023 01:05:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234730AbjKOJFW (ORCPT + 99 others); Wed, 15 Nov 2023 04:05:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234720AbjKOJFB (ORCPT ); Wed, 15 Nov 2023 04:05:01 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27FDE120; Wed, 15 Nov 2023 01:04:58 -0800 (PST) Date: Wed, 15 Nov 2023 09:04:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1700039096; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RLOytOKGBnb6B6iJmpeTnDki+l9w/n1XwObQHovifBs=; b=PrzolQA+m5jo/hrKeMdyMgGQPJUMxcOFUbgxFPb0/ViRvNCeoKpE/08kFEy9dMC+323Vxm XKwRQqAbOif4z7cgleZonVX4ONnJw+wj+T1h86+fcrlq3xh1NH3kON2EqAJZG1gwoNNLSu 8re8R7bVVyu4d/sj+N8Gh+wzwstGbA9EObgwFe44nIo1kuDpFaUaVt9YANtloeZgttA9Dw LRNhB0/oNa3Yz4wXb+p/JtFjTfyErKJFRyIDUOBQkbC9oZL21aGteLaJwrGi2PDc65d09g priLf+9ssVuQaA1ti2CwkcgyS/iEbsd48zJ7EHrh9OyVilFJ/mt52oaCcZVQLA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1700039096; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RLOytOKGBnb6B6iJmpeTnDki+l9w/n1XwObQHovifBs=; b=igLiwJk5GVFqc2Kx5uJ0OuPxYuQVWIocZ3L9201Mx90oWfsXfyPEbpy+fHODpV8qOP+F4X Qcyw5Xqf0PvUHcAw== From: "tip-bot2 for Paul E. McKenney" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched: Use WRITE_ONCE() for p->on_rq Cc: "Paul E. McKenney" , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <170003909617.391.3174076166121466906.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 01:05:32 -0800 (PST) The following commit has been merged into the sched/core branch of tip: Commit-ID: d6111cf45c5787282b2e20d77bdb6b28881d516a Gitweb: https://git.kernel.org/tip/d6111cf45c5787282b2e20d77bdb6b28881d516a Author: Paul E. McKenney AuthorDate: Tue, 31 Oct 2023 11:12:01 -07:00 Committer: Peter Zijlstra CommitterDate: Wed, 15 Nov 2023 09:57:45 +01:00 sched: Use WRITE_ONCE() for p->on_rq Since RCU-tasks uses READ_ONCE(p->on_rq), ensure the write-side matches with WRITE_ONCE(). Signed-off-by: "Paul E. McKenney" Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/e4896e0b-eacc-45a2-a7a8-de2280a51ecc@paulmck-laptop --- kernel/sched/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a708d22..9d5099d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2124,12 +2124,14 @@ void activate_task(struct rq *rq, struct task_struct *p, int flags) enqueue_task(rq, p, flags); - p->on_rq = TASK_ON_RQ_QUEUED; + WRITE_ONCE(p->on_rq, TASK_ON_RQ_QUEUED); + ASSERT_EXCLUSIVE_WRITER(p->on_rq); } void deactivate_task(struct rq *rq, struct task_struct *p, int flags) { - p->on_rq = (flags & DEQUEUE_SLEEP) ? 0 : TASK_ON_RQ_MIGRATING; + WRITE_ONCE(p->on_rq, (flags & DEQUEUE_SLEEP) ? 0 : TASK_ON_RQ_MIGRATING); + ASSERT_EXCLUSIVE_WRITER(p->on_rq); dequeue_task(rq, p, flags); }