From patchwork Wed Feb 28 22:00:12 2024 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: 208046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a1a:b0:17b:cd04:e0c6 with SMTP id 26csp218866rwa; Wed, 28 Feb 2024 14:02:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUgJ1sg4WKgx6cj/26rnS3HyBx59CmDiHv99e0YKkWL2FV/5O2JbtXFVA3TxWD36QjZOzgG98G4d1E8iMSn5vwfpR8Akw== X-Google-Smtp-Source: AGHT+IH4oD38oZVCBg0u/rIBGIPEy11LVxLZ0Irv24DKAQpUr0ZrtAEy5XhGw7gaSa6pZDlu5G5t X-Received: by 2002:a67:f4d9:0:b0:472:6e7e:fd68 with SMTP id s25-20020a67f4d9000000b004726e7efd68mr142288vsn.35.1709157760838; Wed, 28 Feb 2024 14:02:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709157760; cv=pass; d=google.com; s=arc-20160816; b=j5vHkxNdBl639fyabLfk2PJ6rQyxOzCxzp2tc+XGupkAhkh28iovte0pQ1MJnblXsW oW6XWZMQw4Bu4euttwHzPiOk2yCkfHuABAWyf1wq5gfAY7QIqEv+1Mi5rSlu7sRJ9bVx tax7j1Or7AWDYXAyeO/82WlyVbRDv+ZgnxHXNawXYZC7dMIzbEqVkkkwerQr1R85m+9k e2RDgmcVQ9ma5qBRO8tl5wpWbWm8R3AzX6TBYeFF2mw4EDbvFCaRCi7bmoD2Z0RJ6GPF 5tPzq6DZcV8tTqzMDhIU8ni78dA4imO2SJl/BxQGMRhzs+lM+wz51ksgTbc8KDdS11In BT6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=/O4dhYJbx9UPr8JhnBQF/67XXCWwL6RYSgwf8MFcNPY=; fh=rTfvrFb8WHxVsmwdqS+Huea6Drs2rLzUBvWHvQ35d2A=; b=na+6BqhMO3Kx2dbTmZLYXnVqywwy3svgseLNy3r8/spFkDUa6hcNCPSAawpY38ojja xKcHLtHXsKpknyeWMTyAvb5npIyoDBMxuJ+H71yITp7Vs1JML0B5autKE5hqFPpEKNbq fz1AKBCq2ehB/XlUYexDkuwfGnj749CdAOg0TexWPgVjdOPZ9wH3Z6hKTGVAdn6f3WHU PlorFmlrsWJFR1oUL4Ed/1+iVb68tK7s1gwJ2KRnS3vi2ZgmV3irgrmaa3vEWDaqJ5ms qlLYhZUHwOGDojWoq2QJprVupB+qoZj9cxN2MVvMpalAiOO8pnZdK157TZY/BHRcoBQt ZlYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FA47jh11; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-85759-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85759-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id hy8-20020a67e7c8000000b00471b5ea45f9si1029vsb.376.2024.02.28.14.02.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 14:02:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85759-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FA47jh11; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-85759-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85759-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8F7EC1C22BAA for ; Wed, 28 Feb 2024 22:02:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 420AF1649D5; Wed, 28 Feb 2024 22:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FA47jh11"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2Q/1NS/d" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 C354776F06; Wed, 28 Feb 2024 22:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157620; cv=none; b=IhbtnyQmeZTpjw4UrWkJMj4fUcwDImMxRa6WguGs7Cc1GQrigjwlJ75jKWPiYTyXobljiFVy9hRkDa0gNgFakow5DJHcjzxGX5QQJrc3pwZf5X1m7PIWly+Qh8tzJZa5Tyh/Yrep3GQm9AQKp8FdUSqaLg6m5xU9J4r784ORKVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157620; c=relaxed/simple; bh=Kk/u36gHKxOF4l2/tTGL1C6udfYzvSq/cMqYc413BxY=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=n68vhzUiEBcTDy/0rVLl9AAUv2m4GATuGO/qn4inxbhKp5d1gzlSoPFXGm8BcmN10ZtbxVE23j3l0pa3H/Na9hjcSABkMWKsMm48UEwsk/FCa97cgJsI46N7MwoLZbw805s6cJ8Q+pTnA/S6WX8JwwwQOn/Cok2uTaTvnVLdAMM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FA47jh11; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2Q/1NS/d; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 28 Feb 2024 22:00:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1709157612; 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=/O4dhYJbx9UPr8JhnBQF/67XXCWwL6RYSgwf8MFcNPY=; b=FA47jh11PUs1H0QoisO3eYEdQxzsQIw4QNx5KyB7YrlgMJLwDbtf96tDq2kBqlhXAt/2/y ImHGS97+GvSGtJ/w7gNV21OwEptmI1aI3QA9JoAMmImssZDnmbNhIf5JXaFm8uBkWt5G+v 8R2AGoAzrkIRWBuaIZGqW4kZrjMOo5Rx9GHfGsi+0+/gr2IrOq8/t9wA85NYo+85nNzJdc EnMkuHAUt2BYW1WJvDpFAt9Cpv9dkMl8hgA4LCyz/M19dZkfcp38NMVyLc7crhvrbskC/r A3L5rWMYnxV7cR8S84cup2X/uleYKeyqfzdWTgio3fX4wKUTW5wYNWmyCfoT+w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709157612; 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=/O4dhYJbx9UPr8JhnBQF/67XXCWwL6RYSgwf8MFcNPY=; b=2Q/1NS/dQfPRhZV4MSmFBbr51dGNHaLk7Qjwc8IkarOhOe6Z1C5KD0DFrIgqBPZsMtgU7h 9C5+xLj75yVfVLBQ== From: "tip-bot2 for Shrikanth Hegde" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Add READ_ONCE() and use existing helper function to access ->avg_irq Cc: Shrikanth Hegde , Ingo Molnar , Vincent Guittot , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240101154624.100981-3-sshegde@linux.vnet.ibm.com> References: <20240101154624.100981-3-sshegde@linux.vnet.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170915761210.398.716787141204315247.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792181808321017719 X-GMAIL-MSGID: 1792181808321017719 The following commit has been merged into the sched/core branch of tip: Commit-ID: a6965b31888501f889261a6783f0de6afff84f8d Gitweb: https://git.kernel.org/tip/a6965b31888501f889261a6783f0de6afff84f8d Author: Shrikanth Hegde AuthorDate: Mon, 01 Jan 2024 21:16:24 +05:30 Committer: Ingo Molnar CommitterDate: Wed, 28 Feb 2024 15:11:15 +01:00 sched/fair: Add READ_ONCE() and use existing helper function to access ->avg_irq Use existing helper function cpu_util_irq() instead of open-coding access to ->avg_irq. During review it was noted that ->avg_irq could be updated by a different CPU than the one which is trying to access it. ->avg_irq is updated with WRITE_ONCE(), use READ_ONCE to access it in order to avoid any compiler optimizations. Signed-off-by: Shrikanth Hegde Signed-off-by: Ingo Molnar Reviewed-by: Vincent Guittot Link: https://lore.kernel.org/r/20240101154624.100981-3-sshegde@linux.vnet.ibm.com --- kernel/sched/fair.c | 4 +--- kernel/sched/sched.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 127e727..ba36339 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9246,10 +9246,8 @@ static inline bool others_have_blocked(struct rq *rq) if (thermal_load_avg(rq)) return true; -#ifdef CONFIG_HAVE_SCHED_AVG_IRQ - if (READ_ONCE(rq->avg_irq.util_avg)) + if (cpu_util_irq(rq)) return true; -#endif return false; } diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 001fe04..d224267 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -3136,7 +3136,7 @@ static inline bool uclamp_rq_is_idle(struct rq *rq) #ifdef CONFIG_HAVE_SCHED_AVG_IRQ static inline unsigned long cpu_util_irq(struct rq *rq) { - return rq->avg_irq.util_avg; + return READ_ONCE(rq->avg_irq.util_avg); } static inline