diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 9cc230dcc34a..cc7565f1468f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9963,6 +9963,16 @@ static struct sched_group *find_busiest_group(struct lb_env *env) */ update_sd_lb_stats(env, &sds); + /* There is no busy sibling group to pull tasks from */ + if (!sds.busiest) + goto out_balanced; + + busiest = &sds.busiest_stat; + + /* Misfit tasks should be dealt with regardless of the avg load */ + if (busiest->group_type == group_misfit_task) + goto force_balance; + if (sched_energy_enabled()) { struct root_domain *rd = env->dst_rq->rd; int out_balance = 1; @@ -9974,17 +9984,6 @@ static struct sched_group *find_busiest_group(struct lb_env *env) goto out_balanced; } - local = &sds.local_stat; - busiest = &sds.busiest_stat; - - /* There is no busy sibling group to pull tasks from */ - if (!sds.busiest) - goto out_balanced; - - /* Misfit tasks should be dealt with regardless of the avg load */ - if (busiest->group_type == group_misfit_task) - goto force_balance; - /* ASYM feature bypasses nice load balance check */ if (busiest->group_type == group_asym_packing) goto force_balance; @@ -9997,6 +9996,8 @@ static struct sched_group *find_busiest_group(struct lb_env *env) if (busiest->group_type == group_imbalanced) goto force_balance; + local = &sds.local_stat; + /* * If the local group is busier than the selected busiest group * don't try and pull any tasks.