Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3776376rdh; Fri, 29 Sep 2023 01:46:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbUX17hRopEECdeG3EjHDR3jSMSQ09xLolLC4fnEF6P49dSYbxug9O0b9OTNXdDF18EKn2 X-Received: by 2002:a05:6a20:158b:b0:15c:b7ba:1671 with SMTP id h11-20020a056a20158b00b0015cb7ba1671mr5243408pzj.2.1695977209773; Fri, 29 Sep 2023 01:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695977209; cv=none; d=google.com; s=arc-20160816; b=FEvL0kzZDNYRn18lfEECeMpXsRamTHUs30LQ7G9Oxwv5ixUCnUB3207sONsfz5lZwK 7T01GUj/9tXzCp2wc6zDqdT/0RZfbtkV4YF1stvk/clWYaQpjKO1uNXg55Z70R6DtYaN 0U9XzJwNibe62Nb3WGnMJTsoW1i41K2FqkUwdDvGvCEQOKUz0QDijgrZ5F2aj3coc+7G y1G3Xgy4FOyawc0hbhvwOEuB7QEU4Ke6vn1GvEVnKt03XCaQjvQ0K2BbIIjUpzntaRlJ HUkAv1YkZCbLUt9F42/L6//XAEl7P+oqP0lXWwR4Mg7M7VGtQi2tqrNXo4Iwj7Qt7uGI g+bA== 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=D4SoccUJ1iRFQ6pLoGlPK0NevgRuIS+B+21NT0IjnfA=; fh=oQX6hqYjofF22cvBgba23mz/bLNA0hWgE9sfZKNkOyA=; b=caQ//EGKCnBhOPjS/DiFHcC12a+Dph5CAxnpYiRB/UXJkDpzdyvFOewkZzdFYcxUY1 Lb6gNThYXG3Wbe5D4quFK5mmwfHa9ZqKV3Q/Amlnbp0wE7EX8HvhHUgfGr68MbRwjK/0 1wWpKREh/O+NwGNCUNYLzD8GOR0XvfzBTJ940VpmCj6bK0fK6un1x8JuCcrtjkKfecby GPD8YdKooFZ19h8dARfWZpHYruK35/nr6vxycsYixC7TdQcq5eSgVaO8nau5agxhx4ys /E+vloWkIP/bUeuitS3dGBaG7KNNv1efzq44SxJVavar8W0yGsrLrUqGtsqsCl10/DSg i7Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lBH43LqD; dkim=neutral (no key) header.i=@linutronix.de header.b=+8f6XyEZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id ck13-20020a056a02090d00b0056a670ebd6fsi19289887pgb.669.2023.09.29.01.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 01:46:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lBH43LqD; dkim=neutral (no key) header.i=@linutronix.de header.b=+8f6XyEZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 841E9837E242; Fri, 29 Sep 2023 01:39:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232921AbjI2Ije (ORCPT + 99 others); Fri, 29 Sep 2023 04:39:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232968AbjI2IjN (ORCPT ); Fri, 29 Sep 2023 04:39:13 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA046CDB; Fri, 29 Sep 2023 01:39:03 -0700 (PDT) Date: Fri, 29 Sep 2023 08:39:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695976742; 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=D4SoccUJ1iRFQ6pLoGlPK0NevgRuIS+B+21NT0IjnfA=; b=lBH43LqDFtW9fUiABB8CX7BUow9C189hKV1Xfwa1839Bdv5KVcXbj8NAHfNNj4Bu57Wqby 1pr0OszTGvDwvyxNqzeWdvmGlZLHBhnsMk7QwkN9PbOPb4M/2JrX9zgtSwwIww6AgZ2JfI ZI/7X0ujbMVs6+28+qMONO0Es/lBra0lEmfwQjQ36iK3EMFhru3PuDqTsyP8Gs70br9IJK CfXrfusKMFL/4bD5QN7o1eu82R7aJ61c1xT+tP+BPDDLhd3dlmRt8UtaWrDzsR0JYlyvQA l3EOsR4VUEOt+6+4OwgL/WDV0pGQ/3P2bGKQu/GI1BJbyMpVz7YmI+SqsL9MTQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695976742; 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=D4SoccUJ1iRFQ6pLoGlPK0NevgRuIS+B+21NT0IjnfA=; b=+8f6XyEZcRgLZsK1KGPbpLBLTdVsxSpS49svnd2Bu0tEOY3uKfERN5i8vbEClDUmSoCOlS nAKcBhzpveoM6FAA== 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: Ignore (util == 0) optimization in feec() when p_util_max = 0 Cc: "Qais Yousef (Google)" , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230916232955.2099394-3-qyousef@layalina.io> References: <20230916232955.2099394-3-qyousef@layalina.io> MIME-Version: 1.0 Message-ID: <169597674169.27769.13480580087727084162.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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 29 Sep 2023 01:39:51 -0700 (PDT) The following commit has been merged into the sched/core branch of tip: Commit-ID: 23c9519def98ee0fa97ea5871535e9b136f522fc Gitweb: https://git.kernel.org/tip/23c9519def98ee0fa97ea5871535e9b136f522fc Author: Qais Yousef AuthorDate: Sun, 17 Sep 2023 00:29:54 +01:00 Committer: Ingo Molnar CommitterDate: Fri, 29 Sep 2023 10:29:14 +02:00 sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0 find_energy_efficient_cpu() bails out early if effective util of the task is 0 as the delta at this point will be zero and there's nothing for EAS to do. When uclamp is being used, this could lead to wrong decisions when uclamp_max is set to 0. In this case the task is capped to performance point 0, but it is actually running and consuming energy and we can benefit from EAS energy calculations. Rework the condition so that it bails out when both util and uclamp_min are 0. We can do that without needing to use uclamp_task_util(); remove it. Fixes: d81304bc6193 ("sched/uclamp: Cater for uclamp in find_energy_efficient_cpu()'s early exit condition") Signed-off-by: Qais Yousef (Google) Signed-off-by: Ingo Molnar Reviewed-by: Vincent Guittot Reviewed-by: Dietmar Eggemann Acked-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20230916232955.2099394-3-qyousef@layalina.io --- kernel/sched/fair.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4ce949b..284b0ab 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4558,22 +4558,6 @@ static inline unsigned long task_util_est(struct task_struct *p) return max(task_util(p), _task_util_est(p)); } -#ifdef CONFIG_UCLAMP_TASK -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_min, uclamp_max); -} -#else -static inline unsigned long uclamp_task_util(struct task_struct *p, - unsigned long uclamp_min, - unsigned long uclamp_max) -{ - return task_util_est(p); -} -#endif - static inline void util_est_enqueue(struct cfs_rq *cfs_rq, struct task_struct *p) { @@ -7695,7 +7679,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) target = prev_cpu; sync_entity_load_avg(&p->se); - if (!uclamp_task_util(p, p_util_min, p_util_max)) + if (!task_util_est(p) && p_util_min == 0) goto unlock; eenv_task_busy_time(&eenv, p, prev_cpu);