diff mbox

[6/7] sched/fair: Reorder code in update_sd_lb_stats()

Message ID 1461958364-675-7-git-send-email-dietmar.eggemann@arm.com
State New
Headers show

Commit Message

Dietmar Eggemann April 29, 2016, 7:32 p.m. UTC
Do the update of total load and total capacity of sched_domain
statistics before detecting if it is the local group. This and the
inclusion of sg=sg->next into the condition of the do...while loop
makes the code easier to read.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>

---
 kernel/sched/fair.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

-- 
1.9.1
diff mbox

Patch

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e68b9eb5cb97..58da724b6ca4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6801,8 +6801,12 @@  static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
 		update_sg_lb_stats(env, sg, load_idx, local_group, sgs,
 						&overload);
 
+		/* Update sd_lb_stats */
+		sds->total_load += sgs->group_load;
+		sds->total_capacity += sgs->group_capacity;
+
 		if (local_group)
-			goto next_group;
+			continue;
 
 		/*
 		 * In case the child domain prefers tasks go to siblings
@@ -6826,13 +6830,7 @@  static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
 			sds->busiest_stat = *sgs;
 		}
 
-next_group:
-		/* Now, start updating sd_lb_stats */
-		sds->total_load += sgs->group_load;
-		sds->total_capacity += sgs->group_capacity;
-
-		sg = sg->next;
-	} while (sg != env->sd->groups);
+	} while (sg = sg->next, sg != env->sd->groups);
 
 	if (env->sd->flags & SD_NUMA)
 		env->fbq_type = fbq_classify_group(&sds->busiest_stat);