Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp915136iog; Wed, 29 Jun 2022 12:53:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1th/6QjO9s2qU5diEQwk7lmrBLgOsdjSlgqGIuFZ3UDSSmdZbip4neugJYzDINpt7GqSR0O X-Received: by 2002:a17:90a:1588:b0:1e0:a45c:5c1 with SMTP id m8-20020a17090a158800b001e0a45c05c1mr5675954pja.65.1656532437564; Wed, 29 Jun 2022 12:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656532437; cv=none; d=google.com; s=arc-20160816; b=kCa/xG7uvA+wKpcW8ExxHin5jJyJuRbBPpiIYQkmFDiVOOiYQ/51y0uhP3JApaxxjD k8nJfbubuDxUmTQni1aGeXmVoUVF12Zoiilw/QZIsuDSYfZPLxbAKq5q4yipWa2YFt0W 9t8ZwjXSBP8IHgTqmwcO3+WgDkwZwuG5DRZxLDFbOtWtdk/woQTJKtXNG7T/MqWinQmV Ybct7xLOwVLm9MNtgbvwJt5GXcbcG2GjGzenlUtlyeDuzSKiyw8HBpa7i8jFUkSX7zPA X78bYdyEFbOsV6hb/+U+Gaia9OpXqbOIHeLDn+L9+7JAaH/AMu3aW1g5h/w9LyJ0d2g4 urrQ== 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=kKgN1vJfsnzYCor4SC54hmmvuLbGWHtHD3bgdnL6Cec=; b=qEgzAn71Hxcrq4bNiBgPGLzj3ZMcaKH3hX5+L8ELuFClKCbs989XCIVetzZmjjVWWA DWjF7LJMuBEAwAgYjC0bN121+YJrh3LEDj9bhkF86DTjr3YahS909vVUXumoiLUPOBlg kXfBCRqWysLQQY+/RDV5GmtzhzERD8DbK/GrH18np/VGedMwOTaAYUTtFHvI1E+Ad74S mZjpl8Iw+gDxG3G1QBOWOPIbAiEaZOyDd8Yi6xc8l8i3hfTnj3U3o3CO95L/W8bp+aja m0iD+raKt72l6Exyflq+tZrJLw4aMUBLNj+14dZIFmKxLPXMKwAAZnnk8pD9rSFQYpQ0 Ek8A== 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 k10-20020a635a4a000000b0040d3fd7ddcesi23933005pgm.370.2022.06.29.12.53.45; Wed, 29 Jun 2022 12:53:57 -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 S231394AbiF2TsL (ORCPT + 99 others); Wed, 29 Jun 2022 15:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231391AbiF2TsJ (ORCPT ); Wed, 29 Jun 2022 15:48:09 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E9266D80 for ; Wed, 29 Jun 2022 12:48:08 -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 EE7FA1480; Wed, 29 Jun 2022 12:48:08 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.197.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 77FC23F792; Wed, 29 Jun 2022 12:48:07 -0700 (PDT) From: Qais Yousef To: Ingo Molnar , "Peter Zijlstra (Intel)" , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Xuewen Yan , Wei Wang , Jonathan JMChen , Hank , Qais Yousef Subject: [PATCH 4/7] sched/uclamp: Make select_idle_capacity() use util_fits_cpu() Date: Wed, 29 Jun 2022 20:46:29 +0100 Message-Id: <20220629194632.1117723-5-qais.yousef@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629194632.1117723-1-qais.yousef@arm.com> References: <20220629194632.1117723-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,T_SCC_BODY_TEXT_LINE 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 Use the new util_fits_cpu() to ensure migration margin and capacity pressure are taken into account correctly when uclamp is being used otherwise we will fail to consider CPUs as fitting in scenarios where they should. Fixes: b4c9c9f15649 ("sched/fair: Prefer prev cpu in asymmetric wakeup path") Signed-off-by: Qais Yousef --- kernel/sched/fair.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c80c676ab1bc..db1fc6c1aa87 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6540,21 +6540,22 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool static int select_idle_capacity(struct task_struct *p, struct sched_domain *sd, int target) { - unsigned long task_util, best_cap = 0; + unsigned long task_util, util_min, util_max, best_cap = 0; int cpu, best_cpu = -1; struct cpumask *cpus; cpus = this_cpu_cpumask_var_ptr(select_idle_mask); cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr); - task_util = uclamp_task_util(p); - + task_util = task_util_est(p); + util_min = uclamp_eff_value(p, UCLAMP_MIN); + util_max = uclamp_eff_value(p, UCLAMP_MAX); for_each_cpu_wrap(cpu, cpus, target) { unsigned long cpu_cap = capacity_of(cpu); if (!available_idle_cpu(cpu) && !sched_idle_cpu(cpu)) continue; - if (fits_capacity(task_util, cpu_cap)) + if (util_fits_cpu(task_util, util_min, util_max, cpu)) return cpu; if (cpu_cap > best_cap) { -- 2.25.1