From nobody Wed Apr 8 17:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C251CECAAA1 for ; Fri, 28 Oct 2022 06:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbiJ1GoR (ORCPT ); Fri, 28 Oct 2022 02:44:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbiJ1GmZ (ORCPT ); Fri, 28 Oct 2022 02:42:25 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71E281BB941; Thu, 27 Oct 2022 23:42:21 -0700 (PDT) Date: Fri, 28 Oct 2022 06:42:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666939340; 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=GEjp49Gdru83OdMCYGTYXPHKRndNIPLnwf2Koa1z9H8=; b=Kp2d+iMR9e1XDgBThz8EHIIPhaCet6DX1Wo34hjtsInL4ObxHxbqKoZfFjXuh/j3P4I+yn MqOnWTEW5TDOS2CxJ34uVoC+kMH933opBDkFFmCB+ONhR3SRr89QelipvzxyKwFFkKXt1D RXC9+pTjO1QmOMoXiVWGzxKH0Gzz69FZkT801XWVqjTuULUXvZkFyqwBh/YNybxwqr+O/Q wvzEnNTrnglcHg2BvJt4elrNThwto8Hw3UM4JFe/ddONJ8ggcACtFRII8GlrQKr6qTMcNp Zn4IHn7YYXxG3ysLyN5R9BMD5QdpFzo1MblQTYV3A3YtIwSMgjqUX8F9C1NLBQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666939340; 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=GEjp49Gdru83OdMCYGTYXPHKRndNIPLnwf2Koa1z9H8=; b=zovM2xchP60YFd3C1vCDJpr6l5sBTC7MSW+MtnCRpYlM6Rt/HwRJcT1YPVQ6bolKdO8eBd kNJCjIwZvqlZ7JAQ== From: "tip-bot2 for Qais Yousef" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/uclamp: Cater for uclamp in find_energy_efficient_cpu()'s early exit condition Cc: Qais Yousef , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220804143609.515789-8-qais.yousef@arm.com> References: <20220804143609.515789-8-qais.yousef@arm.com> MIME-Version: 1.0 Message-ID: <166693933885.29415.5003832338719378198.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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: d81304bc6193554014d4372a01debdf65e1e9a4d Gitweb: https://git.kernel.org/tip/d81304bc6193554014d4372a01debdf65= e1e9a4d Author: Qais Yousef AuthorDate: Thu, 04 Aug 2022 15:36:07 +01:00 Committer: Peter Zijlstra CommitterDate: Thu, 27 Oct 2022 11:01:19 +02:00 sched/uclamp: Cater for uclamp in find_energy_efficient_cpu()'s early exit = condition If the utilization of the woken up task is 0, we skip the energy calculation because it has no impact. But if the task is boosted (uclamp_min !=3D 0) will have an impact on task placement and frequency selection. Only skip if the util is truly 0 after applying uclamp values. Change uclamp_task_cpu() signature to avoid unnecessary additional calls to uclamp_eff_get(). feec() is the only user now. Fixes: 732cd75b8c920 ("sched/fair: Select an energy-efficient CPU on task w= ake-up") Signed-off-by: Qais Yousef Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220804143609.515789-8-qais.yousef@arm.com --- kernel/sched/fair.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a0ee319..0f32acb 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4280,14 +4280,16 @@ static inline unsigned long task_util_est(struct ta= sk_struct *p) } =20 #ifdef CONFIG_UCLAMP_TASK -static inline unsigned long uclamp_task_util(struct task_struct *p) +static inline unsigned long uclamp_task_util(struct task_struct *p, + unsigned long uclamp_min, + unsigned long uclamp_max) { - return clamp(task_util_est(p), - uclamp_eff_value(p, UCLAMP_MIN), - uclamp_eff_value(p, UCLAMP_MAX)); + return clamp(task_util_est(p), uclamp_min, uclamp_max); } #else -static inline unsigned long uclamp_task_util(struct task_struct *p) +static inline unsigned long uclamp_task_util(struct task_struct *p, + unsigned long uclamp_min, + unsigned long uclamp_max) { return task_util_est(p); } @@ -7205,7 +7207,7 @@ static int find_energy_efficient_cpu(struct task_stru= ct *p, int prev_cpu) target =3D prev_cpu; =20 sync_entity_load_avg(&p->se); - if (!task_util_est(p)) + if (!uclamp_task_util(p, p_util_min, p_util_max)) goto unlock; =20 eenv_task_busy_time(&eenv, p, prev_cpu);