Skip to content

Commit 5fd6d7f

Browse files
ricardonPeter Zijlstra
authored and
Peter Zijlstra
committed
sched/fair: Keep a fully_busy SMT sched group as busiest
When comparing two fully_busy scheduling groups, keep the current busiest group if it represents an SMT core. Tasks in such scheduling group share CPU resources and need more help than tasks in a non-SMT fully_busy group. Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Zhang Rui <rui.zhang@intel.com> Link: https://lore.kernel.org/r/20230406203148.19182-6-ricardo.neri-calderon@linux.intel.com
1 parent 18ad345 commit 5fd6d7f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

kernel/sched/fair.c

+14-2
Original file line numberDiff line numberDiff line change
@@ -9619,10 +9619,22 @@ static bool update_sd_pick_busiest(struct lb_env *env,
96199619
* contention when accessing shared HW resources.
96209620
*
96219621
* XXX for now avg_load is not computed and always 0 so we
9622-
* select the 1st one.
9622+
* select the 1st one, except if @sg is composed of SMT
9623+
* siblings.
96239624
*/
9624-
if (sgs->avg_load <= busiest->avg_load)
9625+
9626+
if (sgs->avg_load < busiest->avg_load)
96259627
return false;
9628+
9629+
if (sgs->avg_load == busiest->avg_load) {
9630+
/*
9631+
* SMT sched groups need more help than non-SMT groups.
9632+
* If @sg happens to also be SMT, either choice is good.
9633+
*/
9634+
if (sds->busiest->flags & SD_SHARE_CPUCAPACITY)
9635+
return false;
9636+
}
9637+
96269638
break;
96279639

96289640
case group_has_spare:

0 commit comments

Comments
 (0)