Skip to content

Commit 3229adb

Browse files
kudureranganathPeter Zijlstra
authored andcommitted
sched/fair: Do not compute overloaded status unnecessarily during lb
Only set sg_overloaded when computing sg_lb_stats() at the highest sched domain since rd->overloaded status is updated only when load balancing at the highest domain. While at it, move setting of sg_overloaded below idle_cpu() check since an idle CPU can never be overloaded. Signed-off-by: K Prateek Nayak <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Vincent Guittot <[email protected]> Reviewed-by: Shrikanth Hegde <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0ac1ee9 commit 3229adb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

kernel/sched/fair.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10410,6 +10410,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
1041010410
bool *sg_overutilized)
1041110411
{
1041210412
int i, nr_running, local_group, sd_flags = env->sd->flags;
10413+
bool balancing_at_rd = !env->sd->parent;
1041310414

1041410415
memset(sgs, 0, sizeof(*sgs));
1041510416

@@ -10427,9 +10428,6 @@ static inline void update_sg_lb_stats(struct lb_env *env,
1042710428
nr_running = rq->nr_running;
1042810429
sgs->sum_nr_running += nr_running;
1042910430

10430-
if (nr_running > 1)
10431-
*sg_overloaded = 1;
10432-
1043310431
if (cpu_overutilized(i))
1043410432
*sg_overutilized = 1;
1043510433

@@ -10442,6 +10440,10 @@ static inline void update_sg_lb_stats(struct lb_env *env,
1044210440
continue;
1044310441
}
1044410442

10443+
/* Overload indicator is only updated at root domain */
10444+
if (balancing_at_rd && nr_running > 1)
10445+
*sg_overloaded = 1;
10446+
1044510447
#ifdef CONFIG_NUMA_BALANCING
1044610448
/* Only fbq_classify_group() uses this to classify NUMA groups */
1044710449
if (sd_flags & SD_NUMA) {

0 commit comments

Comments
 (0)