Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp8001795pxb; Fri, 19 Feb 2021 05:07:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfLNpac/Z0HcznJwZace3LerySKDYf8Xh9pkmjo0pGk9rBcti4GhwjHQe2btyF0BJ163F4 X-Received: by 2002:a17:906:7945:: with SMTP id l5mr8696252ejo.117.1613740036299; Fri, 19 Feb 2021 05:07:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613740036; cv=none; d=google.com; s=arc-20160816; b=lr4mGpNe1X2s0Sc5eTwo2No3L7uhUz5EtPbhb2daUmnlvk0bS5bpwVYr1uKHRdzYF8 7PHYbfDPbrIoyBczYkFTs0VQUJA/igPAHA47E2J2RFzeEASkHUb9W7w8KCoI1hJc7sZL 0UXasimnioeOOZSUJkmpKsJ/BiCj1N8MqXOJCbXftXYpgr1gjVirGxOLf1ujQEj0g5pp juOzTrTUgzXH5h4tjSZcSAbHuS7Lag3buWe5Fs1ZvQ5Nu5+SIwC/EOi9zSjxdc7WhCVU DQlZ46qbW/HWgtdOL6+hO7XKrvdbJMJQB5WOZnbRr36J4chaa9fpSvzYi5qB0cxEHxJk 9g1g== 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=d+ETp6l3rkBTf3V/eJHBcrpasz1Kn6ueRJ13WfuY6go=; b=LtwckptrrJ5TjG3RXkoECtE1OAGYqe1ACU13KaN5CIuxaWulIfEUQPoQR1a6nrXZ6a ENXyz+Kie0b0hZJEVLDfISM8FXqCdl3/p75ps4THj6+y3dvc7O7rxP1kyzcdgtou73W3 Lydy8aqJoPKoDISSAcoMTCb/W1NU+JtrrKLH86K4xuN7ro42OnKlK1i1Ajk9KaD7ZeZm ijoxk3wcy7qmIMKx0YWNo9xE2th2yJtGXAk7oy6LxM7LjHUlygfmbp8DqGF8Q+ivdtgP ByvSyjokfGkD8bQu9tVpzvV1PCy6lJ6wI1f5swJ+TfnoptFiZcr3qLRsXU8egScwPX9z qWCA== 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 e18si6241792edz.446.2021.02.19.05.06.52; Fri, 19 Feb 2021 05:07:16 -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 S230299AbhBSNEr (ORCPT + 99 others); Fri, 19 Feb 2021 08:04:47 -0500 Received: from foss.arm.com ([217.140.110.172]:35952 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230228AbhBSNEC (ORCPT ); Fri, 19 Feb 2021 08:04:02 -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 BC57C13D5; Fri, 19 Feb 2021 05:02:39 -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 23AF83F73B; Fri, 19 Feb 2021 05:02:38 -0800 (PST) From: Valentin Schneider To: linux-kernel@vger.kernel.org Cc: Qais Yousef , Peter Zijlstra , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Morten Rasmussen , Quentin Perret , Pavan Kondeti , Rik van Riel , Lingutla Chandrasekhar Subject: [PATCH v2 5/7] sched/fair: Employ capacity_greater() throughout load_balance() Date: Fri, 19 Feb 2021 13:00:01 +0000 Message-Id: <20210219130003.2890-6-valentin.schneider@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210219130003.2890-1-valentin.schneider@arm.com> References: <20210219130003.2890-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 While at it, replace group_smaller_{min, max}_cpu_capacity() with comparisons of the source group's min/max capacity and the destination CPU's capacity. Reviewed-by: Qais Yousef Signed-off-by: Valentin Schneider --- kernel/sched/fair.c | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index cc16d0e0b9fb..af5ce083c982 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8320,26 +8320,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 fits_capacity(sg->sgc->min_capacity, ref->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 fits_capacity(sg->sgc->max_capacity, ref->sgc->max_capacity); -} - static inline enum group_type group_classify(unsigned int imbalance_pct, struct sched_group *group, @@ -8491,15 +8471,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; @@ -8583,7 +8558,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; @@ -9396,7 +9371,7 @@ static struct rq *find_busiest_queue(struct lb_env *env, * average load. */ if (sd_has_asym_cpucapacity(env->sd) && - capacity_of(env->dst_cpu) < capacity && + !capacity_greater(capacity_of(env->dst_cpu), capacity) && nr_running == 1) continue; -- 2.27.0