From patchwork Wed Nov 15 09:04:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 165212 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2412345vqg; Wed, 15 Nov 2023 01:05:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1BTESMfe26EuXkzdZvColPuevy6X6uBDubpRmLGu5jAJVcw8o7sn8aWd86ad/7JPahhyI X-Received: by 2002:a17:902:f544:b0:1cc:2f9d:6a57 with SMTP id h4-20020a170902f54400b001cc2f9d6a57mr5257439plf.28.1700039142927; Wed, 15 Nov 2023 01:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700039142; cv=none; d=google.com; s=arc-20160816; b=zlJ4qY0O/GscN3RS/wNPCnNbNM+/RqT5gJ2ug7EoiYXHc6bE1K0IP0l8SRI1n0Y+KB kkTfvAEVy+lr2ccZZiiYj2mtny1oihKJY9MoJDJyMDU9MAehpGTgHVWtPiTBIZHHSqYz WA1ARyB4FuZ6rPsT9q3mwXRC5A6OGi5yy5GCdJeHp1oeuFJdIxAPb6nuzKg01rsi8cGR 3+rOgQHB2SKs3hNoBRQQJLMR5DSyjAndMurLO/I0CWje5tvz57u5z09fglqeRNNW4oG3 INbFfsC7GAP/dpmN+Nzii5b+mV4XM+duFACO+PMqZhFPY/eMopNLajXb3Wm+Xz+VkDt1 2QRQ== 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; 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z7-20020a170902834700b001c9f54d26bfsi9548812pln.516.2023.11.15.01.05.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 01:05:42 -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; 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 CE4808138995; Wed, 15 Nov 2023 01:05:41 -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 S234784AbjKOJFX (ORCPT + 28 others); Wed, 15 Nov 2023 04:05:23 -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 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:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782620244196685075 X-GMAIL-MSGID: 1782620244196685075 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); }