From patchwork Fri Oct 28 06:42:18 2022 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: 12108 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp659144wru; Thu, 27 Oct 2022 23:44:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+HahB4xuTYn4Cu/pxsPfQFDZ1ehqRtXfKFfSFsr4qSQvpldc+/tI+zr1fXbNoIf377jmL X-Received: by 2002:a65:6e82:0:b0:41a:9b73:f0e6 with SMTP id bm2-20020a656e82000000b0041a9b73f0e6mr46324404pgb.371.1666939488181; Thu, 27 Oct 2022 23:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666939488; cv=none; d=google.com; s=arc-20160816; b=MWyzkB3I7Vow5XYIUYzSF5d9EekWExH94+AurwUENSK41KYoHYIBDrz7ag/LtE1Fi2 cUa399hxQFxIXgxhwK6x2nbYkZV8PYxVSwablERE0Bm9AODbxirGNEDe+6znr9SdTcvs 3dPgdZBI482dtXJEHPLtTy7w2k9ZKgu3sQOqjsnOYq6MQeiH/v+Mu9C7hP+Qb07DoSh8 Jayacr6cugLFntJVNgXaUuAfIWL+sZNzd17IBK/szpq0o1n8wFYmdZrZwAvgH62+wDw9 jz6wYYFe4i6S5ANt1eGXE+7tydEOKYWkNZwHjCMt9/F4lQ5nRd7hQm6U+v6A7xdAwQAb gYYw== 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 header.s=2020e header.b=zovM2xch; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a056a00169100b0056bae3f63b5si4938705pfc.327.2022.10.27.23.44.35; Thu, 27 Oct 2022 23:44:48 -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 header.s=2020e header.b=zovM2xch; 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747912740621909763?= X-GMAIL-MSGID: =?utf-8?q?1747912740621909763?= 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);