aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorten Rasmussen <morten.rasmussen@arm.com>2013-03-22 15:03:30 +0000
committerVincent Guittot <vincent.guittot@linaro.org>2013-05-16 13:46:36 +0200
commitc3f4db779c0b09e4ea795166946209512f441883 (patch)
tree5595b7e93a906b18ac422e67bd182425bb357dbe
parenta575e19bf6fb52986d28361058af4e34bab6dfdb (diff)
sched: Pull tasks from cpus with multiple tasks when idleupstream-task-placement-on-mixed-cpu-power-systems-v1
If a cpu is idle and another cpu has more than one runnable task, pull one of them without considering cpu_power source or target. This allows low cpu_power cpus to offload potentially oversubscribed high cpu_power cpus. In heterogeneous systems containing cpus with different cpu_power, the load-balancer will put more tasks on sched_domains with high (above default) cpu_power cpus and fewer on sched_domains with low cpu_power cpus. Hence, if the number of running tasks is equal to the number of cpus, the load-balancer may decide to leave low cpu_power idle and placing more than one task on each high cpu_power cpu. This is not optimal use of the available compute resources. Placing one task on each cpu before adding more to any of the high cpu_power cpus should generally give a better overall throughput regardless of the cpu_power of the cpus. Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
-rw-r--r--kernel/sched/fair.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index fd0ed9119d4..f39509ea5fa 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4033,7 +4033,8 @@ static int move_tasks(struct lb_env *env)
if (sched_feat(LB_MIN) && load < 16 && !env->sd->nr_balance_failed)
goto next;
- if ((load / 2) > env->imbalance)
+ if ((load / 2) > env->imbalance &&
+ (env->idle != CPU_IDLE && env->idle != CPU_NEWLY_IDLE))
goto next;
move_task(p, env);
@@ -4530,6 +4531,15 @@ static inline void update_sg_lb_stats(struct lb_env *env,
if (overloaded_cpu)
sgs->group_imb = 1;
+ /*
+ * When idle balancing pull tasks if more than one task per cpu
+ * in group
+ */
+ if (env->idle == CPU_IDLE || env->idle == CPU_NEWLY_IDLE) {
+ if (group->group_weight < sgs->sum_nr_running)
+ sgs->group_imb = 1;
+ }
+
sgs->group_capacity = DIV_ROUND_CLOSEST(group->sgp->power,
SCHED_POWER_SCALE);
if (!sgs->group_capacity)
@@ -4757,8 +4767,13 @@ void fix_small_imbalance(struct lb_env *env, struct sd_lb_stats *sds)
min(sds->this_load_per_task, sds->this_load + tmp);
pwr_move /= SCHED_POWER_SCALE;
- /* Move if we gain throughput */
- if (pwr_move > pwr_now)
+ /*
+ * Move if we gain throughput, or if we have cpus idling while others
+ * are running more than one task.
+ */
+ if ((pwr_move > pwr_now) ||
+ (sds->busiest_group_weight < sds->busiest_nr_running &&
+ (env->idle == CPU_IDLE || env->idle == CPU_NEWLY_IDLE)))
env->imbalance = sds->busiest_load_per_task;
}