When wake up task, the CPU selection is heavily relying on CPU utilization. But in some cases before the CPU enter idle state, its utilization is a high value and it will not be updated during CPU's idle state. So this will introduce misunderstanding when select CPU.
This patch is to update idle CPUs utilization value until the value is decayed to 0. And because after the CPU enter idle state, it has no any task on its run queue, so should not introduce big load when iterate cfs rq's hierarchy.
Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e0b50ca..8e8767b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5955,6 +5955,12 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync) sg = sd->groups; sg_target = sg;
+ /* update idle CPUs utilization */ + for_each_online_cpu(i) { + if (idle_cpu(i) && cpu_util(i)) + update_blocked_averages(i); + } + if (sysctl_sched_is_big_little) {
/* -- 1.9.1