Morten Rasmussen | 25 Mar 16:40 2013

[RFC PATCH 0/2] sched: Task placement on mixed cpu_power systems

In multiprocessor systems with cpus with different compute capabilities it is
essential for performance that heavy tasks are scheduled on the most capable
cpus. The current scheduler does not handle such performance heterogeneous
systems optimally. This patch set proposes a small set of changes that
significantly improves performance on these systems.

Looking at the current scheduler design the most obvious way to represent the
compute capability of each individual cpu is to use cpu_power as this is
already used for load-balancing. The recently included entity load-tracking
adds the infrastructure to distinguish between heavy and light tasks.

The proposed changes moves heavy tasks to cpus with higher cpu_power to get
better performance and fixes load-balancing issues for caused by the cpu_power
difference when having one heavy task per cpu.

The patches requires load-balancing to be based on entity load-tracking and
there uses Alex Shi's patch set as the starting point:

The patches are based in 3.9-rc2 and have been tested on an ARM vexpress TC2
big.LITTLE testchip containing five cpus: 2xCortex-A15 + 3xCortex-A7.
Additional testing and refinements might be needed later as more sophisticated
platforms become available.

cpu_power A15: 1441
cpu_power A7:   606

cyclictest:	cyclictest -a -t 2 -n -D 10
(Continue reading)

Morten Rasmussen | 25 Mar 16:40 2013

[RFC PATCH 1/2] sched: Force migration on a better cpu

From: Vincent Guittot <vincent.guittot <at>>

In a system with different cpu_power for cpus, we can fall in a
situation where a heavy task runs on a cpu with a lower cpu_power
which by definition means lower compute capacity and lower
performance. We can detect this scenario and force the task to migrate
to a cpu with higher compute capacity to improve performance for
demanding tasks.

Signed-off-by: Vincent Guittot <vincent.guittot <at>>
Signed-off-by: Morten Rasmussen <morten.rasmussen <at>>
 kernel/sched/fair.c |   36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4243143..4781cdd 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
 <at>  <at>  -4444,7 +4444,7  <at>  <at>  static inline void update_sg_lb_stats(struct lb_env *env,
 	unsigned long nr_running, max_nr_running, min_nr_running;
 	unsigned long load, max_cpu_load, min_cpu_load;
-	unsigned int balance_cpu = -1, first_idle_cpu = 0;
+	unsigned int balance_cpu = -1, first_idle_cpu = 0, overloaded_cpu = 0;
 	unsigned long avg_load_per_task = 0;
 	int i;

 <at>  <at>  -4482,6 +4482,11  <at>  <at>  static inline void update_sg_lb_stats(struct lb_env *env,
 				max_nr_running = nr_running;
(Continue reading)

Morten Rasmussen | 25 Mar 16:40 2013

[RFC PATCH 2/2] sched: Pull tasks from cpus with multiple tasks when idle

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 <at>>
Reviewed-by: Vincent Guittot <vincent.guittot <at>>
 kernel/sched/fair.c |   21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4781cdd..095885c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
 <at>  <at>  -4039,7 +4039,8  <at>  <at>  static int move_tasks(struct lb_env *env)
 		if (sched_feat(LB_MIN) && load < 16 && !env->sd->nr_balance_failed)
 			goto next;
(Continue reading)