Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp293048pxf; Thu, 11 Mar 2021 04:09:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzqbBrTQxT8i3ZE/SGzJ31DrVxvSdTkGtP9W8dWdcsUddXHC2dze5WyfIMy0wQAt9Xepk1 X-Received: by 2002:a17:906:a157:: with SMTP id bu23mr2665808ejb.491.1615464588930; Thu, 11 Mar 2021 04:09:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615464588; cv=none; d=google.com; s=arc-20160816; b=ZC+jW62s6AwQkx5/TR1roRx0O40qNQr7Lsl9VDHU/d2oi0hLPmUC0jYQql+HtQgJg6 yM214kvTxles0hE4y/w6JzmwR8aMrJg5Hkf9n0x4ErvXTuPkpMliWgIp1NZaWJiWte7P 5/wAtJrlIcNwyK5tBS2utX8T+tlrcEn0ss6jf7FIm9O/nWTkD6sxOTjHK7t+j+o7wYyr 0A9Yt7GuzmpudGVF/6onmf92WHrq+kU0U+L7u9WsZBJK/FDWaskQoSPFYwfRTjD/JHyH oKU27wAV0GLehRbPVxa832Fi/pKhdrPM1WYV0zXVWp+L2RE2S8AU7exkkZNHHDBmDT9E +CFw== 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=UYjsOHHQ3Fob+4asny1n9W/7MzRwR9QJXyKlHxe/Uic=; b=GvPxK89E5ErBve5XKibXooWvxNxtNBnZ+Gr3ROCZ5b6lgXhMIGe/QLLt39WvzfplM0 GlYX03r9k5KgBlUxKxxc53xEn4+z5HkL5SOsNQFM1V9cq5yvEwJmi2+aSrPusHxk1+4U 12XLwMXYqpCgJ4X42XkuRFExVZ2qsEUs5FrjXdmwmF8jeZ3lzoEySE7ZTxwD8ycUcqAV /0Qor2+k+8lQhvT/06Xs1l5Qyl7eVhJemWn/sXp0nQp3G1tzzbyHwRyYuvv1y2vrkNUW csMrWJDN3DrmcQyLNHGBh8LV9Oc/Y+20C/29N5SWWw8p4/odhJs2v8ZSJKC8RbzrbGQ0 oBFw== 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 ga15si1660346ejc.24.2021.03.11.04.09.26; Thu, 11 Mar 2021 04:09:48 -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 S233069AbhCKMGI (ORCPT + 99 others); Thu, 11 Mar 2021 07:06:08 -0500 Received: from foss.arm.com ([217.140.110.172]:34084 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233024AbhCKMFo (ORCPT ); Thu, 11 Mar 2021 07:05:44 -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 4A04DED1; Thu, 11 Mar 2021 04:05:44 -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 B6F0E3F793; Thu, 11 Mar 2021 04:05:42 -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 v3 5/7] sched/fair: Employ capacity_greater() throughout load_balance() Date: Thu, 11 Mar 2021 12:05:25 +0000 Message-Id: <20210311120527.167870-6-valentin.schneider@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210311120527.167870-1-valentin.schneider@arm.com> References: <20210311120527.167870-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 ddb2ab3edf6d..1e8a242cd1f7 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8350,26 +8350,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, @@ -8518,15 +8498,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; @@ -8610,7 +8585,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; @@ -9410,7 +9385,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.25.1