From patchwork Wed Dec 20 10:11:58 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: 181586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2537773dyi; Wed, 20 Dec 2023 02:17:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IETki8v8VTx+yaBfxTRW3DmSjDIr/4r4vhBj+SLdBvhzDaqJc897JMbU427rWNaRVfbCVvI X-Received: by 2002:a17:902:db05:b0:1d3:c21c:940d with SMTP id m5-20020a170902db0500b001d3c21c940dmr5152858plx.34.1703067448731; Wed, 20 Dec 2023 02:17:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703067448; cv=none; d=google.com; s=arc-20160816; b=eHBoSahuj7CBX11wx6+hP23SApMIXJFMoJzbbitQIStcHcPtmZ3k1uqb9bDNAknylk /EugFkRrjcKhLM0nOPuXEg5HWU9HoUIjICDXNyKUUNC7/rnpLYy0NoTqU+VBVvalvj1r MEz8iQWXiExxEwhRHAfGRTGTXhx1wA4NRB5qCs9EftsJBCw0OCsDLglNL0IJNpoBH1YI Xf4myM4MISbKYyCmUQHTOtM0UafAl0CvUPujRdCd7YZSUv6ePsEclTMyg9BAHn1VNvcI OV62y7dXqV+k5sHyBnpzbRCP9rLndQ+93ALrWG/iMj2XzzMDsTb912/RvNoL7AdofhDQ T68Q== ARC-Message-Signature: i=1; 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=H6hwmAWQKjMEl12UtoecaxvFXwVUb9+J4SBmMUc4vPU=; fh=l0Qm1uBjevoUpDV0AaI/maDk4UN5/dDVhpL1ALVIqbQ=; b=LeKMHKlmQEV6NHMCBBSbtIgNJcxuF7QNgWzwTioPSTUNa4hKnVGCwlEOF/y/PzAPbm etp3YXVzaicu/skrS5argTYvb/OK5HjI7qwSZz9ZsSiLJjMlehAbVBj6pHJbcupPl4X8 l1nX7YdjxbLLWF603CN35HSeNWqYxAYtzqAXemKLZw/WC4u6qGR2jziyfw0xI//3i3gz 1xm52YSsyRcKgx7yqL/hcMl1FBqRcizfzFTKz3Y0vGEykLAltjCZXE0xis4yMLDXrm/c nkTb8jkZaW0d9IRYH2kdG47aM3MQS4TJheTK3nJzuzw21GtcIP6UwXK6amirXqe+sbLZ LmPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GK8YwXgW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=fmHVrzKM; spf=pass (google.com: domain of linux-kernel+bounces-6716-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6716-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q4-20020a170902a3c400b001d0050e2466si21163427plb.23.2023.12.20.02.17.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 02:17:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6716-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GK8YwXgW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=fmHVrzKM; spf=pass (google.com: domain of linux-kernel+bounces-6716-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6716-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7B0EF287EAE for ; Wed, 20 Dec 2023 10:17:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A72720DF0; Wed, 20 Dec 2023 10:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GK8YwXgW"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fmHVrzKM" X-Original-To: linux-kernel@vger.kernel.org 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 1F40D20B03; Wed, 20 Dec 2023 10:12:01 +0000 (UTC) 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, 20 Dec 2023 10:11:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1703067119; 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=H6hwmAWQKjMEl12UtoecaxvFXwVUb9+J4SBmMUc4vPU=; b=GK8YwXgWgW4n2bBFQZEQlJwIXmhTdQ+2/QWlHs55owmgnfP50smqY5A4EvhHmUKAeUxtsA +cU+eB8mkCq1lzygE46rcCJwl1CXJ7j55LdOXDYBWn+kVi18IuG010kZSGudVROxAMlJwQ HLy3OhQUwiF0QqducoKl916BxwodpEMfDTk/QMpJ1XCEzcDgluqCre+whGvzF/CjBdMDtf uNt2wStV4bUsIpjVFqXvOzUTBLy1RyvTJT5NVwhjR7LoUZ3Yu/lAsxaqPke2iLULFl18od 4m2gS7kmRAqvZykJzsAo4tlihGP9q/wS0nCJwzz2DHGfmxQwA1Vhmwzkv6e5Ug== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703067119; 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=H6hwmAWQKjMEl12UtoecaxvFXwVUb9+J4SBmMUc4vPU=; b=fmHVrzKMEr54qo/fQo97gUsJ3vkPqWxJTnEDqRQLZsI1R35FTPMYuagsAJHOQ6Ka2boFvr vG0uoA+9AgPR91Cw== 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: Use existing helper functions to access ->avg_rt and ->avg_dl Cc: Shrikanth Hegde , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231220065522.351915-1-sshegde@linux.vnet.ibm.com> References: <20231220065522.351915-1-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: <170306711877.398.11023074478817453654.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: 1785795653111333226 X-GMAIL-MSGID: 1785795653111333226 The following commit has been merged into the sched/core branch of tip: Commit-ID: 6b5943af9198d21b4fdb1ce14ee11d11119cc709 Gitweb: https://git.kernel.org/tip/6b5943af9198d21b4fdb1ce14ee11d11119cc709 Author: Shrikanth Hegde AuthorDate: Wed, 20 Dec 2023 12:25:22 +05:30 Committer: Ingo Molnar CommitterDate: Wed, 20 Dec 2023 11:04:05 +01:00 sched/fair: Use existing helper functions to access ->avg_rt and ->avg_dl This is a minor code simplification. There are helper functions called cpu_util_dl() and cpu_util_rt() which gives the average utilization of DL and RT respectively. But there are few places in code where these variables are open-coded. Instead use the helper function so that code becomes simpler and easier to maintain later on. No change in functionality intended. Signed-off-by: Shrikanth Hegde Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20231220065522.351915-1-sshegde@linux.vnet.ibm.com --- kernel/sched/fair.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bcea3d5..0263106 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9212,19 +9212,17 @@ static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq) static inline bool others_have_blocked(struct rq *rq) { - if (READ_ONCE(rq->avg_rt.util_avg)) + if (cpu_util_rt(rq)) return true; - if (READ_ONCE(rq->avg_dl.util_avg)) + if (cpu_util_dl(rq)) return true; 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; } @@ -9481,8 +9479,8 @@ static unsigned long scale_rt_capacity(int cpu) * avg_thermal.load_avg tracks thermal pressure and the weighted * average uses the actual delta max capacity(load). */ - used = READ_ONCE(rq->avg_rt.util_avg); - used += READ_ONCE(rq->avg_dl.util_avg); + used = cpu_util_rt(rq); + used += cpu_util_dl(rq); used += thermal_load_avg(rq); if (unlikely(used >= max))