diff options
author | Morten Rasmussen <morten.rasmussen@arm.com> | 2016-10-14 09:41:10 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-11-16 04:29:06 -0500 |
commit | 9e0994c0a1c1f82c705f1f66388e1bcffcee8bb9 (patch) | |
tree | 201386837c202af26b39a8ff1e07b2f35ea3b807 | |
parent | bf475ce0a3dd75b5d1df6c6c14ae25168caa15ac (diff) |
sched/fair: Avoid pulling tasks from non-overloaded higher capacity groups
For asymmetric CPU capacity systems it is counter-productive for
throughput if low capacity CPUs are pulling tasks from non-overloaded
CPUs with higher capacity. The assumption is that higher CPU capacity is
preferred over running alone in a group with lower CPU capacity.
This patch rejects higher CPU capacity groups with one or less task per
CPU as potential busiest group which could otherwise lead to a series of
failing load-balancing attempts leading to a force-migration.
Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dietmar.eggemann@arm.com
Cc: freedom.tan@mediatek.com
Cc: keita.kobayashi.ym@renesas.com
Cc: mgalbraith@suse.de
Cc: sgurrappadi@nvidia.com
Cc: vincent.guittot@linaro.org
Cc: yuyang.du@intel.com
Link: http://lkml.kernel.org/r/1476452472-24740-5-git-send-email-morten.rasmussen@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | kernel/sched/fair.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index faf8f18616e6..ee39bfda5ae5 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -7073,6 +7073,17 @@ group_is_overloaded(struct lb_env *env, struct sg_lb_stats *sgs) | |||
7073 | return false; | 7073 | return false; |
7074 | } | 7074 | } |
7075 | 7075 | ||
7076 | /* | ||
7077 | * group_smaller_cpu_capacity: Returns true if sched_group sg has smaller | ||
7078 | * per-CPU capacity than sched_group ref. | ||
7079 | */ | ||
7080 | static inline bool | ||
7081 | group_smaller_cpu_capacity(struct sched_group *sg, struct sched_group *ref) | ||
7082 | { | ||
7083 | return sg->sgc->min_capacity * capacity_margin < | ||
7084 | ref->sgc->min_capacity * 1024; | ||
7085 | } | ||
7086 | |||
7076 | static inline enum | 7087 | static inline enum |
7077 | group_type group_classify(struct sched_group *group, | 7088 | group_type group_classify(struct sched_group *group, |
7078 | struct sg_lb_stats *sgs) | 7089 | struct sg_lb_stats *sgs) |
@@ -7176,6 +7187,20 @@ static bool update_sd_pick_busiest(struct lb_env *env, | |||
7176 | if (sgs->avg_load <= busiest->avg_load) | 7187 | if (sgs->avg_load <= busiest->avg_load) |
7177 | return false; | 7188 | return false; |
7178 | 7189 | ||
7190 | if (!(env->sd->flags & SD_ASYM_CPUCAPACITY)) | ||
7191 | goto asym_packing; | ||
7192 | |||
7193 | /* | ||
7194 | * Candidate sg has no more than one task per CPU and | ||
7195 | * has higher per-CPU capacity. Migrating tasks to less | ||
7196 | * capable CPUs may harm throughput. Maximize throughput, | ||
7197 | * power/energy consequences are not considered. | ||
7198 | */ | ||
7199 | if (sgs->sum_nr_running <= sgs->group_weight && | ||
7200 | group_smaller_cpu_capacity(sds->local, sg)) | ||
7201 | return false; | ||
7202 | |||
7203 | asym_packing: | ||
7179 | /* This is the busiest node in its class. */ | 7204 | /* This is the busiest node in its class. */ |
7180 | if (!(env->sd->flags & SD_ASYM_PACKING)) | 7205 | if (!(env->sd->flags & SD_ASYM_PACKING)) |
7181 | return true; | 7206 | return true; |