Skip to content

Commit 0635490

Browse files
zgpenglinuxPeter Zijlstra
authored andcommitted
sched/fair: Move calculate of avg_load to a better location
In calculate_imbalance function, when the value of local->avg_load is greater than or equal to busiest->avg_load, the calculated sds->avg_load is not used. So this calculation can be placed in a more appropriate position. Signed-off-by: zgpeng <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Samuel Liao <[email protected]> Reviewed-by: Vincent Guittot <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent e3f73ec commit 0635490

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/sched/fair.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9460,8 +9460,6 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
94609460
local->avg_load = (local->group_load * SCHED_CAPACITY_SCALE) /
94619461
local->group_capacity;
94629462

9463-
sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
9464-
sds->total_capacity;
94659463
/*
94669464
* If the local group is more loaded than the selected
94679465
* busiest group don't try to pull any tasks.
@@ -9470,6 +9468,9 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
94709468
env->imbalance = 0;
94719469
return;
94729470
}
9471+
9472+
sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
9473+
sds->total_capacity;
94739474
}
94749475

94759476
/*

0 commit comments

Comments
 (0)