* update_sg_lb_stats - Update sched_group's statistics for load balancing.
  * @env: The load balancing environment.
  * @group: sched_group whose statistics are to be updated.
- * @load_idx: Load index of sched_domain of this_cpu for load calc.
- * @local_group: Does group contain this_cpu.
  * @sgs: variable to hold the statistics for this group.
- * @overload: Indicate pullable load (e.g. >1 runnable task).
+ * @sg_status: Holds flag indicating the status of the sched_group
  */
 static inline void update_sg_lb_stats(struct lb_env *env,
-                       struct sched_group *group, int load_idx,
-                       int local_group, struct sg_lb_stats *sgs,
-                       bool *overload)
+                                     struct sched_group *group,
+                                     struct sg_lb_stats *sgs,
+                                     int *sg_status)
 {
+       int local_group = cpumask_test_cpu(env->dst_cpu, sched_group_span(group));
+       int load_idx = get_sd_load_idx(env->sd, env->idle);
        unsigned long load;
        int i, nr_running;
 
 
                nr_running = rq->nr_running;
                if (nr_running > 1)
-                       *overload = true;
+                       *sg_status |= SG_OVERLOAD;
 
 #ifdef CONFIG_NUMA_BALANCING
                sgs->nr_numa_running += rq->nr_numa_running;
                if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
                    sgs->group_misfit_task_load < rq->misfit_task_load) {
                        sgs->group_misfit_task_load = rq->misfit_task_load;
-                       *overload = 1;
+                       *sg_status |= SG_OVERLOAD;
                }
        }
 
        struct sched_group *sg = env->sd->groups;
        struct sg_lb_stats *local = &sds->local_stat;
        struct sg_lb_stats tmp_sgs;
-       int load_idx;
-       bool overload = false;
        bool prefer_sibling = child && child->flags & SD_PREFER_SIBLING;
+       int sg_status = 0;
 
 #ifdef CONFIG_NO_HZ_COMMON
        if (env->idle == CPU_NEWLY_IDLE && READ_ONCE(nohz.has_blocked))
                env->flags |= LBF_NOHZ_STATS;
 #endif
 
-       load_idx = get_sd_load_idx(env->sd, env->idle);
-
        do {
                struct sg_lb_stats *sgs = &tmp_sgs;
                int local_group;
                                update_group_capacity(env->sd, env->dst_cpu);
                }
 
-               update_sg_lb_stats(env, sg, load_idx, local_group, sgs,
-                                               &overload);
+               update_sg_lb_stats(env, sg, sgs, &sg_status);
 
                if (local_group)
                        goto next_group;
 
        if (!env->sd->parent) {
                /* update overload indicator if we are at root domain */
-               if (READ_ONCE(env->dst_rq->rd->overload) != overload)
-                       WRITE_ONCE(env->dst_rq->rd->overload, overload);
+               WRITE_ONCE(env->dst_rq->rd->overload, sg_status & SG_OVERLOAD);
        }
 }