sched/core: Simplify core-wide task selection
authorPeter Zijlstra <peterz@infradead.org>
Tue, 24 Aug 2021 09:05:47 +0000 (11:05 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 5 Oct 2021 13:51:33 +0000 (15:51 +0200)
commitbc9ffef31bf59819c9fc032178534ff9ed7c4981
treebc429b08b7beba8f18d90aa38d10e1270250fc1a
parentc33627e9a1143afb988fb98d917c4a2faa16f9d9
sched/core: Simplify core-wide task selection

Tao suggested a two-pass task selection to avoid the retry loop.

Not only does it avoid the retry loop, it results in *much* simpler
code.

This also fixes an issue spotted by Josh Don where, for SMT3+, we can
forget to update max on the first pass and get to do an extra round.

Suggested-by: Tao Zhou <tao.zhou@linux.dev>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Don <joshdon@google.com>
Reviewed-by: Vineeth Pillai (Microsoft) <vineethrp@gmail.com>
Link: https://lkml.kernel.org/r/YSS9+k1teA9oPEKl@hirez.programming.kicks-ass.net
kernel/sched/core.c