Some of the load_balance() helper functions will put tasks on cpus with cpu_power=1 when they are completely idle. This patch changes this behaviour.
The patch is a quick fix. The load_balance() helper functions should be revisited to implement proper handling of cpus with cpu_power=1.
Signed-off-by: Morten Rasmussen morten.rasmussen@arm.com CC: Ingo Molnar mingo@kernel.org CC: Peter Zijlstra peterz@infradead.org CC: Catalin Marinas catalin.marinas@arm.com --- kernel/sched/fair.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f637ea5..4610463 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3952,6 +3952,13 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) }
/* + * Vacate cpus disabled by the power scheduler even if the cache is + * hot + */ + if (!power_cpu_balance(env->src_cpu)) + return 1; + + /* * Aggressive migration if: * 1) task is cache cold, or * 2) too many balance attempts have failed. @@ -4500,6 +4507,11 @@ static inline void update_sg_lb_stats(struct lb_env *env, update_group_power(env->sd, env->dst_cpu); } else if (time_after_eq(jiffies, group->sgp->next_update)) update_group_power(env->sd, env->dst_cpu); + + if (!power_cpu_balance(env->dst_cpu)) { + *balance = 0; + return; + } }
/* Adjust by relative CPU power of the group */