Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5508798rdb; Sat, 16 Sep 2023 23:04:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBJ6H+g3RPoL9x+tpA/1py91aGbY9K6WU0hLF28Ddnj9CafskuiTFTiOqAkFs7+ODCOX8v X-Received: by 2002:a05:6358:7249:b0:134:f28f:aa47 with SMTP id i9-20020a056358724900b00134f28faa47mr7862552rwa.23.1694930691325; Sat, 16 Sep 2023 23:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694930691; cv=none; d=google.com; s=arc-20160816; b=iaDftplCmcRnyq4G/KU6jJv26bQoGR6wkIJdl+bB6Mxl63bgORygxNvaCbt5e53Vjy NuI5qLCMLGrgnyKhMlJlxy3ZWMvWFqaUTQ5c8JBsuvjh7iWCx+kvOvYcLp0YSsQFoUrn Q22Gk6iKGG0rkiLlUsiLeQ5l8Y6BnZyJNCgi2oqMvhstyRvr4PUs+DZPyn98UoMpgP1c M3+Y4aEvLTiBSd7fQw/W9bSZBl2rsmOYDtfpLEe5Eh+PFE/SE/O45RjDAeXmQuw2j5FS kg64zyGwZDr+OpiqoDjtaviZvQv1OmDTgpsrdloSs9/LDrm2nvBePTYx10XqI8v29X/V JuIw== 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 :dkim-signature; bh=KjwrFheoCHUo12B1slBH8742esS72cLDk94QJ+87wIg=; fh=eLqfSDI3er94FV57ulBVumm7/LJZpHgqDZ2dkdMO0cM=; b=NAnfo+jTuym6pJGP9BkjjdwCpIDlJU5U1+i7tBP3m5zh9DG8ykP4vXOSRTybTA2AV+ fEx/aNnbk41WXWPMw124TGqf67dfqtJ9ttz+jUdOd3zMrg696/bnou7McB19b+BmQ0+y M+pR0Sdr98UtpvG+KGzekPdm5WJwYaDuNqpF1xZiYV35z26omTPihlYY1NeP0QTBMYqA lVAauLvwygQUmEP2lcCPi/qFmDHzJKakgOaNp7OhTBU6W3KUa9yvXG037avQ8yXV5Bdn 8iXH42jOuw2wzcj1A8EL7pQn86zqCuIfKUVHknEw7IUBGzqV/cT4WdMFtt+0pmRT0ED8 Gg6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=JKqcgBNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id bv9-20020a056a00414900b00690228b1d45si6043339pfb.342.2023.09.16.23.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 23:04:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=JKqcgBNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 6CE4D84B1F9E; Sat, 16 Sep 2023 16:33:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235508AbjIPXaa (ORCPT + 99 others); Sat, 16 Sep 2023 19:30:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232389AbjIPXaS (ORCPT ); Sat, 16 Sep 2023 19:30:18 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3211ACD3 for ; Sat, 16 Sep 2023 16:30:13 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-402d499580dso36058615e9.1 for ; Sat, 16 Sep 2023 16:30:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1694907011; x=1695511811; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KjwrFheoCHUo12B1slBH8742esS72cLDk94QJ+87wIg=; b=JKqcgBNEEnaF+XBWVoJMf8mIPlL7G+jVMkGzgxujVdgHdO/jsehHsNxNN8secWe1cs bDt7+o4/0Ar9atEk9TZcXdLzZ26qauMTXlVbZtYusOJ1iqjftmv4kjqaZsXWPUGtJcFT hrexe+Y3ERRf2MUfw+7UQFI1oDjGflYarO8fweO0yrYaenoqmTkpsXf/ph8+QioansRn 1wSCJKfW5Du1jpzGzhSdlaUtWFUTW8caf7D7rE+Qdk9pbIx8ujA9tm4QbK2A5Kh5+Pj5 YOT/BUh1D9zlZaOa2i80q7W1cLvKhHbub0zq7S1oIRhZhOtMCvqezd+BL0Qik5rsqtPh Zfsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694907011; x=1695511811; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KjwrFheoCHUo12B1slBH8742esS72cLDk94QJ+87wIg=; b=SpRiy356ZmaMVPFq/sOzEuCQ9Wi+nPHWx3sdNfwo9CfMo9Q4dcpzbIVNED1/d6Zjt/ Eym/NYory/v4J0KQmW7L+VhmW+v+hb1EKz7MAP6ZBnBJ4UaasMhLBzUXdlcivlj5sOMT QukAaOou8LFgaNhBk12PDy3RKS9nKoRicL2iSNUACIlZP3uB8+CPD+aZBQt/U5PYnKOy SaRBisrirbNobFaWd/K7kOCd0dPGXfBXxRQK0U1qflr0nMCt0kCfiQBopMJLkXCHyWhM ICnBvULf9D8OXyAecboNZ/AJRhcIX9wU87aiWyWC34vE6FX/Mfj42kWQraEwcQRubxdO hDyw== X-Gm-Message-State: AOJu0YyUWWPUjfW9XaYf94O/5SAEwk6Xqf4++fV34RhnLGxdF3engYdE +f0Wpe4ntwT7SdVrhEDmb0Uy/g== X-Received: by 2002:a05:600c:2055:b0:3fb:efe2:34a2 with SMTP id p21-20020a05600c205500b003fbefe234a2mr4568815wmg.5.1694907011584; Sat, 16 Sep 2023 16:30:11 -0700 (PDT) Received: from airbuntu.. (host109-151-228-137.range109-151.btcentralplus.com. [109.151.228.137]) by smtp.gmail.com with ESMTPSA id b14-20020a05600c11ce00b003fee8502999sm11203929wmi.18.2023.09.16.16.30.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 16:30:11 -0700 (PDT) From: Qais Yousef To: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Lukasz Luba , Wei Wang , Xuewen Yan , Hank , Jonathan JMChen , Hongyan Xia , Qais Yousef Subject: [PATCH v5 2/3] sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0 Date: Sun, 17 Sep 2023 00:29:54 +0100 Message-Id: <20230916232955.2099394-3-qyousef@layalina.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916232955.2099394-1-qyousef@layalina.io> References: <20230916232955.2099394-1-qyousef@layalina.io> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 pete.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 (pete.vger.email [0.0.0.0]); Sat, 16 Sep 2023 16:33:22 -0700 (PDT) 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") Reviewed-by: Vincent Guittot Reviewed-by: Dietmar Eggemann Signed-off-by: Qais Yousef (Google) --- 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 3a0a28a0b9c7..0d0582e02409 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4560,22 +4560,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) { @@ -7687,7 +7671,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); -- 2.34.1