Received: by 10.223.185.116 with SMTP id b49csp394168wrg; Fri, 16 Feb 2018 00:25:27 -0800 (PST) X-Google-Smtp-Source: AH8x2270cwP1IGMlPz86/jrHnb5A2MF8XCymH8Cb1P1M8DKsEE8QrkMpIGaMQNrFj7rxUA0UvG2f X-Received: by 2002:a17:902:7042:: with SMTP id h2-v6mr5194794plt.217.1518769526895; Fri, 16 Feb 2018 00:25:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518769526; cv=none; d=google.com; s=arc-20160816; b=LOHhTEjOxV3ZOxZ4/f8c10WHyNnibQL1KRLp+DOwXC6LYqAqB7+hebM5giLViZgvts CnR0hu2cQpfpwrnhFF6HL+rMfDJEKKfjckrNxcylB97cOfhOq/OVOA4B+6Wa+nb+d52V JWDk7rseiASlz0mk3DQDJlYR4gXYW4jVdDYoNYjKS62i7CuOGO+pH385EcxqGbM87qIS 0c9xx6h4VWl3R5toU4+Iy9EOfBCasdyBf7M0MTODgIB5tCDmJfmc9CtJpRWSE25xERQr dEGGYpOG3LoShPScvoPC5ZFtLz9R7hFkkXj6Ncj3v3XsJhj8kWmMRsHg2hB33vxXot7c tWUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=raYgAvkeRCmGSQBDxQyOQS9En/+5hrwAc52CwdSqnnQ=; b=qrvTn8c5UNqfbeNMGoD78zkAzT5QkR7rcl7wA8tQ4MellVnPSp9QJ3x6kXyKj8HHe9 W+lAFA9MpEaSO5GKZihbub8YWxp2SU5H1E0tw5jSUZsWwHhufvK0v2r+dd8rIWA01fA3 7LmoYuqaoDZNn17ncZ3/S3BhJCHeF+xlXHeKuTElzgXB9BsMlVJGk7GGYR5zcQOoZKc4 i3naNMsbP8K+4WTGurApB6+rPElmPcjF5HCbhbZnxYDw98OXtn17WxKxccmcMIsZR1aB bKc4YrKddr3JU2YSy9NZrlS1N1IhSDHz2COe6GtvIhRwMAFP8JNUGj+S5UA+W6jsehp5 WdAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3si960463pgr.447.2018.02.16.00.25.12; Fri, 16 Feb 2018 00:25:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425748AbeBOQVl (ORCPT + 99 others); Thu, 15 Feb 2018 11:21:41 -0500 Received: from foss.arm.com ([217.140.101.70]:57118 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425701AbeBOQVa (ORCPT ); Thu, 15 Feb 2018 11:21:30 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 942B3164F; Thu, 15 Feb 2018 08:21:30 -0800 (PST) Received: from e105550-lin.cambridge.arm.com (e105550-lin.cambridge.arm.com [10.1.211.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3E9553F24D; Thu, 15 Feb 2018 08:21:29 -0800 (PST) From: Morten Rasmussen To: peterz@infradead.org, mingo@redhat.com Cc: valentin.schneider@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, Morten Rasmussen Subject: [PATCH 4/7] sched/fair: Avoid unnecessary balancing of asymmetric capacity groups Date: Thu, 15 Feb 2018 16:20:51 +0000 Message-Id: <1518711654-23503-5-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518711654-23503-1-git-send-email-morten.rasmussen@arm.com> References: <1518711654-23503-1-git-send-email-morten.rasmussen@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On systems with asymmetric cpu capacities, a skewed load distribution might yield better throughput than balancing load per group capacity. For example, preferring high capacity cpus for compute intensive tasks leaving low capacity cpus idle rather than balancing the number of idle cpus across different cpu types. Instead, let load-balance back off if the busiest group isn't really overloaded. cc: Ingo Molnar cc: Peter Zijlstra Signed-off-by: Morten Rasmussen --- kernel/sched/fair.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0d70838ed711..e036aef3f10a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7794,6 +7794,19 @@ group_smaller_cpu_capacity(struct sched_group *sg, struct sched_group *ref) ref->sgc->min_capacity * 1024; } +/* + * group_similar_cpu_capacity: Returns true if the minimum capacity of the + * compared groups differ by less than 12.5%. + */ +static inline bool +group_similar_cpu_capacity(struct sched_group *sg, struct sched_group *ref) +{ + long diff = sg->sgc->min_capacity - ref->sgc->min_capacity; + long max = max(sg->sgc->min_capacity, ref->sgc->min_capacity); + + return abs(diff) < max >> 3; +} + static inline enum group_type group_classify(struct sched_group *group, struct sg_lb_stats *sgs) @@ -7925,6 +7938,15 @@ static bool update_sd_pick_busiest(struct lb_env *env, group_smaller_cpu_capacity(sds->local, sg)) return false; + /* + * Candidate sg doesn't face any severe imbalance issues so + * don't disturb unless the groups are of similar capacity + * where balancing is more harmless. + */ + if (sgs->group_type == group_other && + !group_similar_cpu_capacity(sds->local, sg)) + return false; + asym_packing: /* This is the busiest node in its class. */ if (!(env->sd->flags & SD_ASYM_PACKING)) -- 2.7.4