sched/fair: Fix SMT4 group_smt_balance handling
authorTim Chen <tim.c.chen@linux.intel.com>
Thu, 7 Sep 2023 17:42:21 +0000 (10:42 -0700)
committerIngo Molnar <mingo@kernel.org>
Wed, 13 Sep 2023 13:03:06 +0000 (15:03 +0200)
commit450e749707bc1755f22b505d9cd942d4869dc535
treec5bba96bc95d14a8679acc9fd1420e595a525e30
parentf8858d96061f5942216c6abb0194c3ea7b78e1e8
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: fee1759e4f04 ("sched/fair: Determine active load balance for SMT sched groups")
Acked-by: Shrikanth Hegde <sshegde@linux.vnet.ibm.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/6cd1633036bb6b651af575c32c2a9608a106702c.camel@linux.intel.com
kernel/sched/fair.c