Current code select busiest rq mostly consider only from weighted load this point of view; so it's possible to select one CPU with most weighted load value but this load are contributes by some small load tasks, on the other hand there have one another CPU with misfit task but it may have no chance to migrate task to higher capacity CPU.
This patch is to add one more checking for selection busiest rq if find only one misfit task on the rq and it's possible to migrate task from lower capacity CPU to higher capacity CPU.
Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ed9fbed..1cf0e37 100755 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7777,6 +7777,24 @@ static struct rq *find_busiest_queue(struct lb_env *env, continue;
/* + * After enable energy awared scheduling, it has higher + * priority to migrate misfit task rather than from most + * loaded CPU; E.g. one CPU with single misfit task and + * other CPUs with multiple lower load tasks, we should + * firstly make sure the misfit task can be migrated onto + * higher capacity CPU. + */ + if (energy_aware() && + capacity_orig_of(i) < capacity_orig_of(env->dst_cpu) && + rq->cfs.h_nr_running == 1 && rq->misfit_task && + env->busiest_group_type == group_misfit_task) { + busiest_load = wl; + busiest_capacity = capacity; + busiest = rq; + break; + } + + /* * For the load comparisons with the other cpu's, consider * the weighted_cpuload() scaled with the cpu capacity, so * that the load can be moved away from the cpu that is -- 2.7.4