Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp568424rdb; Mon, 15 Jan 2024 06:35:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGr6IxSoKEGHkU6TckHEOp+fVjC5mg623el7ppekaz1jPuCnweeALKNeX0OWU7/vbks3526 X-Received: by 2002:a05:6a00:3004:b0:6d9:d770:bb70 with SMTP id ay4-20020a056a00300400b006d9d770bb70mr3090633pfb.33.1705329326092; Mon, 15 Jan 2024 06:35:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705329326; cv=none; d=google.com; s=arc-20160816; b=H3/9vyfsxPmzOL/GmlPcsd06+6QomVd7XbduHtUomyX9f2OSBtRjOR0S9F7uduqni6 rYuwzX2UNHBd7tfoKorAel6oZ1yoodxizChmL7seW11229uosQcW8AITquwolF57VjT6 WNPfzgoaDM99Qc0ZBL5ZGwwxz6mrnOFRHYTpJjsD0RPAP2+fwarVD/kKgoVja2zewO0h hiA4MKJfyugYBr35K+m7b6DAbGGn0Kk1GeRaK0JSz0CG4+fQ70wdlmxVZk36UaS/P6M0 y6jq5FvxmiQos2ZubsDoN/6rHyT1YgVlQgoQ3CMvdhWpmY6mdgsL0yOWmUOecjtXFmAl 7ACA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ea+v3S+dvSjtYY49RsELw8xUsgGOF8ipbZt2B9TPQXI=; fh=ceGY8gx3ag7g2dEDXECiNTMxyZp1SjBjuBUw72Wx2IM=; b=w6gyDKOYOk7bqBeqHDRgujq/DO0QJk02fz6VUPtxk0UUDJYcdaGfJzbh0WmNgPR6sI gXIXZfmSum/iwpNTQLiO3P2AEyjPjjs+LJNWHdUiGqGD3bRimwMJ7z14+nXAu1Utvob7 JIWug/i5QRolwGkWStUVyVQq0T4tNZjg7X0PoNwm2OAwuaaFLEKN51mYLridOsgXSURl Iq2ZA7NtXgJd5kHJXTudaLAyqNuM+YpIBTO5WY4/Cyn5iounvTmeskLj2v8jsJ3ZRUVf SUU24yxJtA4JJZ6pRjUw6FK2wFQg8ceN/F393ebWV2zzQUD2NATA3+VCuPFHsdPGvcCk Gsag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26093-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26093-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2-20020a639742000000b005cf7b6d2dcdsi1531366pgo.241.2024.01.15.06.35.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 06:35:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26093-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26093-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26093-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 BCBBC2827B8 for ; Mon, 15 Jan 2024 14:35:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 576EB179AB; Mon, 15 Jan 2024 14:34:48 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A6421798E for ; Mon, 15 Jan 2024 14:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 02C4A1515; Mon, 15 Jan 2024 06:35:32 -0800 (PST) Received: from e126645.arm.com (e126645.nice.arm.com [10.34.100.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7ECDB3F6C4; Mon, 15 Jan 2024 06:34:43 -0800 (PST) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Pierre Gondois , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Huang Ying Subject: [PATCH v2 3/3] sched/fair: Use rq in update_blocked_averages() Date: Mon, 15 Jan 2024 15:34:26 +0100 Message-Id: <20240115143427.1820628-4-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240115143427.1820628-1-pierre.gondois@arm.com> References: <20240115143427.1820628-1-pierre.gondois@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit update_blocked_averages() could receive a 'struct rq' instead of a CPU number to avoid converting the CPU number to a 'struct rq' multiple times. Suggested-by: Shrikanth Hegde Signed-off-by: Pierre Gondois --- kernel/sched/fair.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 97d9e0d32337..c70bb993f473 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9349,10 +9349,9 @@ static unsigned long task_h_load(struct task_struct *p) } #endif -static void update_blocked_averages(int cpu) +static void update_blocked_averages(struct rq *rq) { bool decayed = false, done = true; - struct rq *rq = cpu_rq(cpu); struct rq_flags rf; rq_lock_irqsave(rq, &rf); @@ -12026,7 +12025,7 @@ static bool update_nohz_stats(struct rq *rq) if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick))) return true; - update_blocked_averages(cpu); + update_blocked_averages(rq); return rq->has_blocked_load; } @@ -12286,7 +12285,7 @@ static int newidle_balance(struct rq *this_rq, struct rq_flags *rf) raw_spin_rq_unlock(this_rq); t0 = sched_clock_cpu(this_cpu); - update_blocked_averages(this_cpu); + update_blocked_averages(this_rq); rcu_read_lock(); for_each_domain(this_cpu, sd) { @@ -12376,7 +12375,7 @@ static __latent_entropy void run_rebalance_domains(struct softirq_action *h) return; /* normal load balance */ - update_blocked_averages(this_rq->cpu); + update_blocked_averages(this_rq); rebalance_domains(this_rq, idle); } -- 2.25.1