Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1215694pxb; Thu, 28 Jan 2021 10:36:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOI+atFuqY2/GkBfBYT9UqTvTL5Rn0oKJseG7d1WCLfvi7Q3cQUgzMCUYoa508tPpFy/Qs X-Received: by 2002:a05:6402:1383:: with SMTP id b3mr990523edv.131.1611858993274; Thu, 28 Jan 2021 10:36:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611858993; cv=none; d=google.com; s=arc-20160816; b=L5pWr3yKQYgXtsWgktLZpeE5r0SC0uF4uM7MoUW7ybYxOhXILQ706HFk+Jb/VcklXY y2DWOZmzp/pd3Amsr+IisreOosP36JN0GKhomKi7IbDcIBwQHU0THiHvZPzhRyAxYdV+ knPqlEMGHxIttKnU2b/GgibJZeoDzrGuvT1IOQJvDrIBbNphWTlysipHyifykod2ftOO o5gBreD+b4Lmm78e5CmphYebSaCKEjmfObgbr7GHN6TjKPoLYiJZwjGsV79goLbYUstH tMaa0pGc9FdFe/CJG9wLwpPWVkn5Y5iAQz7l2VK2GD+JoJxB/N6B/tzif1wXCdLqMEEO HfUg== 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=bM3cFONg9jrS16gJx4W7e9rY1b75KmN4cRrS0TOGLUg=; b=BQpuHK0kz6z4HW1mO4PMCdMSu7dWOHI8qD63udFiXo9MsuP6b4qrphANfH3qS7pU5z EdjbeHLQPNQvfQseEEGCReqT6mbi6gdFZSC50uZAg0J9c/8ZdyoD5jgLI3HCfIeSGuJI 1BrsWnWDrWuky7ikm8N64kOsN2fUMcxyFL3SPaDiQYtMkU2BnBtN9Gb6UgyFiEsw8tS5 FVAZM2MeBfmuGGYkIydKANLr8QPTt+HzwT8MBzEhoIXE/vhAfz9Orledv2FhjD+vBrbZ iKf0KQuHckDnCxkZBFzobkINxeoSd5sUH3xeJ4bqwWHx9uwDynKpiuMwrEBebSrUvfT6 lXAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si3041484ejj.235.2021.01.28.10.36.08; Thu, 28 Jan 2021 10:36:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232138AbhA1Sf0 (ORCPT + 99 others); Thu, 28 Jan 2021 13:35:26 -0500 Received: from foss.arm.com ([217.140.110.172]:37358 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231446AbhA1Sc6 (ORCPT ); Thu, 28 Jan 2021 13:32:58 -0500 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 72C541478; Thu, 28 Jan 2021 10:32:12 -0800 (PST) Received: from e113632-lin.cambridge.arm.com (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 045203F719; Thu, 28 Jan 2021 10:32:10 -0800 (PST) From: Valentin Schneider To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Morten Rasmussen , Qais Yousef , Quentin Perret , Pavan Kondeti , Rik van Riel Subject: [PATCH 4/8] sched/fair: Use dst_cpu's capacity rather than group {min, max} capacity Date: Thu, 28 Jan 2021 18:31:37 +0000 Message-Id: <20210128183141.28097-5-valentin.schneider@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210128183141.28097-1-valentin.schneider@arm.com> References: <20210128183141.28097-1-valentin.schneider@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Comparing capacity extrema of local and source sched_group's doesn't make much sense when at the day of the day the imbalance will be pulled by a known env->dst_cpu, whose capacity can be anywhere within the local group's capacity extrema. Replace group_smaller_{min, max}_cpu_capacity() with comparisons of the source group's min/max capacity and the destination CPU's capacity. Signed-off-by: Valentin Schneider --- kernel/sched/fair.c | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 58ce0b22fcb0..0959a770ecc0 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8352,26 +8352,6 @@ group_is_overloaded(unsigned int imbalance_pct, struct sg_lb_stats *sgs) return false; } -/* - * group_smaller_min_cpu_capacity: Returns true if sched_group sg has smaller - * per-CPU capacity than sched_group ref. - */ -static inline bool -group_smaller_min_cpu_capacity(struct sched_group *sg, struct sched_group *ref) -{ - return capacity_greater(ref->sgc->min_capacity, sg->sgc->min_capacity); -} - -/* - * group_smaller_max_cpu_capacity: Returns true if sched_group sg has smaller - * per-CPU capacity_orig than sched_group ref. - */ -static inline bool -group_smaller_max_cpu_capacity(struct sched_group *sg, struct sched_group *ref) -{ - return capacity_greater(ref->sgc->max_capacity, sg->sgc->max_capacity); -} - static inline enum group_type group_classify(unsigned int imbalance_pct, struct sched_group *group, @@ -8523,15 +8503,10 @@ static bool update_sd_pick_busiest(struct lb_env *env, if (!sgs->sum_h_nr_running) return false; - /* - * Don't try to pull misfit tasks we can't help. - * We can use max_capacity here as reduction in capacity on some - * CPUs in the group should either be possible to resolve - * internally or be covered by avg_load imbalance (eventually). - */ + /* Don't try to pull misfit tasks we can't help */ if (static_branch_unlikely(&sched_asym_cpucapacity) && sgs->group_type == group_misfit_task && - (!group_smaller_max_cpu_capacity(sg, sds->local) || + (!capacity_greater(capacity_of(env->dst_cpu), sg->sgc->max_capacity) || sds->local_stat.group_type != group_has_spare)) return false; @@ -8615,7 +8590,7 @@ static bool update_sd_pick_busiest(struct lb_env *env, */ if (sd_has_asym_cpucapacity(env->sd) && (sgs->group_type <= group_fully_busy) && - (group_smaller_min_cpu_capacity(sds->local, sg))) + (capacity_greater(sg->sgc->min_capacity, capacity_of(env->dst_cpu)))) return false; return true; -- 2.27.0