mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Morten Rasmussen <morten.rasmussen@arm.com>
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 <morten.rasmussen@arm.com>
Subject: [PATCH 4/7] sched/fair: Avoid unnecessary balancing of asymmetric capacity groups
Date: Thu, 15 Feb 2018 16:20:51 +0000	[thread overview]
Message-ID: <1518711654-23503-5-git-send-email-morten.rasmussen@arm.com> (raw)
In-Reply-To: <1518711654-23503-1-git-send-email-morten.rasmussen@arm.com>

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 <mingo@redhat.com>
cc: Peter Zijlstra <peterz@infradead.org>

Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
---
 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

  parent reply	other threads:[~2018-02-15 16:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 16:20 [PATCH 0/7] sched/fair: Migrate 'misfit' tasks on asymmetric capacity systems Morten Rasmussen
2018-02-15 16:20 ` [PATCH 1/7] sched: Add static_key for asymmetric cpu capacity optimizations Morten Rasmussen
2018-02-16 13:47   ` Peter Zijlstra
2018-02-16 15:41     ` Morten Rasmussen
2018-02-16 16:51       ` Peter Zijlstra
2018-02-19 11:49         ` Morten Rasmussen
2018-02-16 17:39       ` Quentin Perret
2018-02-16 17:43         ` Peter Zijlstra
2018-02-15 16:20 ` [PATCH 2/7] sched/fair: Add group_misfit_task load-balance type Morten Rasmussen
2018-02-19 13:56   ` Peter Zijlstra
2018-02-19 13:58     ` Peter Zijlstra
2018-02-20 16:01       ` Morten Rasmussen
2018-02-15 16:20 ` [PATCH 3/7] sched/fair: Consider misfit tasks when load-balancing Morten Rasmussen
2018-02-15 16:20 ` Morten Rasmussen [this message]
2018-02-19 14:50   ` [PATCH 4/7] sched/fair: Avoid unnecessary balancing of asymmetric capacity groups Peter Zijlstra
2018-02-19 14:53     ` Peter Zijlstra
2018-02-20 16:22       ` Morten Rasmussen
2018-02-19 15:10   ` Peter Zijlstra
2018-02-20 16:33     ` Morten Rasmussen
2018-02-20 18:26       ` Peter Zijlstra
2018-02-23 16:38         ` Morten Rasmussen
2018-02-23 16:47           ` Peter Zijlstra
2018-02-26 15:06             ` Morten Rasmussen
2018-02-15 16:20 ` [PATCH 5/7] sched/fair: Kick nohz balance if rq->misfit_task Morten Rasmussen
2018-02-15 16:20 ` [PATCH 6/7] sched: Rename root_domain->overload to should_idle_balance Morten Rasmussen
2018-02-16  9:14   ` Juri Lelli
2018-02-16  9:49     ` Peter Zijlstra
2018-02-16 11:59       ` Valentin Schneider
2018-02-15 16:20 ` [PATCH 7/7] sched/fair: Set sd->should_idle_balance when misfit Morten Rasmussen
2018-02-28  7:46 ` [PATCH 0/7] sched/fair: Migrate 'misfit' tasks on asymmetric capacity systems Gaku Inami
2018-03-01 11:59   ` Valentin Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1518711654-23503-5-git-send-email-morten.rasmussen@arm.com \
    --to=morten.rasmussen@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®