Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1938387rwi; Fri, 28 Oct 2022 00:28:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yuA8PGp/65J0y9neSJwuiP2sBWsPLjzBFla0Tn4hxrpjyY3l5VGaOafju/Hukq6SxoTCz X-Received: by 2002:a17:902:ee8b:b0:186:a226:7207 with SMTP id a11-20020a170902ee8b00b00186a2267207mr25917742pld.49.1666942114590; Fri, 28 Oct 2022 00:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666942114; cv=none; d=google.com; s=arc-20160816; b=eK2q1tN30cyusc5Q7M5RGxhL3NncfF4c1nyFzoeuxH0xAmwHwlCtwz7Qf1/C6xjTPU bjMoh3KvWz05iih025DxhFQ7JJ02oToedjQTIS+bSPl9nj3kxqW0JKMogZ/i3zGcAlwa nl/T3DAugry12R6cHWLFR7w9XX0lN9Ja1G+Sq/uSlIkFhPBdbo6ZpyM/kktD6U1/Cs+v khsHTHzdBcosleFCy2R3JUzQBR6XphHfGevZhchmmF1eclmvTrunT83/Y7t3sbD8eq8x frKh4XxJ9asfluKOOJIu/3JlKV3F07Zvwf4bvIZ+eZp8O6i8le5/gmCbI3ew4YsdDDAf mZgg== 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=GEjp49Gdru83OdMCYGTYXPHKRndNIPLnwf2Koa1z9H8=; b=hcZb2f56AcQXXAi9Y9P4/SwHo9ilJqpuS9pwRLsyJfZdu+RyiuHrNY7HqR9jsfBd/r CsP+FiwTrFjXnv0tNrbfvAra6/9yuXwDhD26K31BJLW7Flr/yZ5qDNCoXPzCgBHg7B6C mbamt1YDFo12dcV5L8jdGj0GeKSbd6IWrb9SPICUZUbSBy6PCtCZPZS46tBHnIbLr2tP SBxXE1R1CSpZLjZWmTuFdOk42gCoRnHTNaBYFJblL0zFYwEmduheSzn/s5r5wT1cbOQj bjmMpybHgYOIbXjsvG1JEEEiAGD1YDbUOMAwbQT4TdG4p2ClEXBb/LCjoEW6FYgEYRIh RjdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Kp2d+iMR; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x14-20020a634a0e000000b0046040a85eacsi4281874pga.538.2022.10.28.00.28.21; Fri, 28 Oct 2022 00:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Kp2d+iMR; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbiJ1GoR (ORCPT + 99 others); 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: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 The following commit has been merged into the sched/core branch of tip: Commit-ID: d81304bc6193554014d4372a01debdf65e1e9a4d Gitweb: https://git.kernel.org/tip/d81304bc6193554014d4372a01debdf65e1e9a4d 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 != 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 wake-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 task_struct *p) } #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_struct *p, int prev_cpu) target = prev_cpu; sync_entity_load_avg(&p->se); - if (!task_util_est(p)) + if (!uclamp_task_util(p, p_util_min, p_util_max)) goto unlock; eenv_task_busy_time(&eenv, p, prev_cpu);