Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp337890imn; Thu, 4 Aug 2022 07:56:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR7FxevO/8tWZDuyrPl19ZYEUypZSVQVLY3Z36a5IMGKBJ7ha1gT9Ij2LhsixhWGCi+YHys6 X-Received: by 2002:a17:90b:1b0c:b0:1f5:1041:a4f3 with SMTP id nu12-20020a17090b1b0c00b001f51041a4f3mr11207445pjb.234.1659624960062; Thu, 04 Aug 2022 07:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659624960; cv=none; d=google.com; s=arc-20160816; b=GtVwoTzn4LxY3+bi7tJUKxz2IuZbanO+QdYcxQN4VsVORKHSlB+OPixAxW8EjKshso DmdUxyElBLJeitk9VXuLa1+X+lN2yWlwgQoW99cFNuTqj2LA5JUw0IjrSaObAVREPUDz 0HJjp3afIlESZa61IvLpUp3AWVMfxJcG17xHj0vgh3Jao//U6hXsK0BUYsi6/HdrrkOB FlzDCUBjhY43i0OcfSx1jhWX2PykbzalZkZ70lfSUBGGQmT6OK86FyUdhsgUylay+Ea1 PC31XHghvf/RuzDCkQOd2ngW9OaDh4oRj6lzzceawwYT7UMdzS0StpmZc/Jc4WodsfxA Gsdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nNIIQKAVtP0bWnDDLuxKUX9xvUn3XHy48vaThMPZrWc=; b=cBYpOHS362ZptW5PlY++jESM/g64yd7LrpSwa9Kq1IA7Ajj7x0DAxoFD3KBCLV14Mz Y23EH2qmIUSG/pwrmnFFtOMvYCGd3Vbj4i6NTXTzXPrFK/wxdJmyJVmS3r/9GH2JjAbi RULVLmaRRLAD5dZuubXd+f4TNQ9CaD16c2Jb1B18NnJUnYUJ4M5qVdp/sKLoJ/SCSNhX 1KhVHftNuXPqO/9Xvk7MwnJjPC5n72PIyFfVWXyQ0bXXgNFAXSXQMVwN5SQ3gSs1OHro WRRcdpTOxXbefzVsSWXt/PnB4IEjyuuFeimYIgXNh2CgrwGPYILDmcrzbcH00n5E88bN j1Cg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m8-20020a637108000000b00415fcde23b8si29645pgc.225.2022.08.04.07.55.44; Thu, 04 Aug 2022 07:56:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239879AbiHDOhX (ORCPT + 99 others); Thu, 4 Aug 2022 10:37:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239839AbiHDOgx (ORCPT ); Thu, 4 Aug 2022 10:36:53 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6874E4B490 for ; Thu, 4 Aug 2022 07:36:52 -0700 (PDT) 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 8FA581480; Thu, 4 Aug 2022 07:36:52 -0700 (PDT) Received: from localhost.localdomain (unknown [10.57.10.177]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 63C8A3F73B; Thu, 4 Aug 2022 07:36:50 -0700 (PDT) From: Qais Yousef To: Ingo Molnar , "Peter Zijlstra (Intel)" , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Xuewen Yan , Lukasz Luba , Wei Wang , Jonathan JMChen , Hank , Qais Yousef Subject: [PATCH v2 7/9] sched/uclamp: Cater for uclamp in find_energy_efficient_cpu()'s early exit condition Date: Thu, 4 Aug 2022 15:36:07 +0100 Message-Id: <20220804143609.515789-8-qais.yousef@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804143609.515789-1-qais.yousef@arm.com> References: <20220804143609.515789-1-qais.yousef@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE 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 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 --- 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 4c3a5240d7e3..59ba7106ddc6 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4108,14 +4108,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); } @@ -7029,7 +7031,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); -- 2.25.1