Skip to content

Commit 450e749

Browse files
pdxChenIngo Molnar
authored andcommitted
sched/fair: Fix SMT4 group_smt_balance handling
For SMT4, any group with more than 2 tasks will be marked as group_smt_balance. Retain the behaviour of group_has_spare by marking the busiest group as the group which has the least number of idle_cpus. Also, handle rounding effect of adding (ncores_local + ncores_busy) when the local is fully idle and busy group imbalance is less than 2 tasks. Local group should try to pull at least 1 task in this case so imbalance should be set to 2 instead. Fixes: fee1759 ("sched/fair: Determine active load balance for SMT sched groups") Acked-by: Shrikanth Hegde <[email protected]> Signed-off-by: Tim Chen <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
1 parent f8858d9 commit 450e749

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

kernel/sched/fair.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9580,7 +9580,7 @@ static inline long sibling_imbalance(struct lb_env *env,
95809580
imbalance /= ncores_local + ncores_busiest;
95819581

95829582
/* Take advantage of resource in an empty sched group */
9583-
if (imbalance == 0 && local->sum_nr_running == 0 &&
9583+
if (imbalance <= 1 && local->sum_nr_running == 0 &&
95849584
busiest->sum_nr_running > 1)
95859585
imbalance = 2;
95869586

@@ -9768,6 +9768,15 @@ static bool update_sd_pick_busiest(struct lb_env *env,
97689768
break;
97699769

97709770
case group_smt_balance:
9771+
/*
9772+
* Check if we have spare CPUs on either SMT group to
9773+
* choose has spare or fully busy handling.
9774+
*/
9775+
if (sgs->idle_cpus != 0 || busiest->idle_cpus != 0)
9776+
goto has_spare;
9777+
9778+
fallthrough;
9779+
97719780
case group_fully_busy:
97729781
/*
97739782
* Select the fully busy group with highest avg_load. In
@@ -9807,6 +9816,7 @@ static bool update_sd_pick_busiest(struct lb_env *env,
98079816
else
98089817
return true;
98099818
}
9819+
has_spare:
98109820

98119821
/*
98129822
* Select not overloaded group with lowest number of idle cpus

0 commit comments

Comments
 (0)