linux/kernel/sched
Peter Zijlstra 04193d590b sched: Fix balance_push() vs __sched_setscheduler()
The purpose of balance_push() is to act as a filter on task selection
in the case of CPU hotplug, specifically when taking the CPU out.

It does this by (ab)using the balance callback infrastructure, with
the express purpose of keeping all the unlikely/odd cases in a single
place.

In order to serve its purpose, the balance_push_callback needs to be
(exclusively) on the callback list at all times (noting that the
callback always places itself back on the list the moment it runs,
also noting that when the CPU goes down, regular balancing concerns
are moot, so ignoring them is fine).

And here-in lies the problem, __sched_setscheduler()'s use of
splice_balance_callbacks() takes the callbacks off the list across a
lock-break, making it possible for, an interleaving, __schedule() to
see an empty list and not get filtered.

Fixes: ae79270232 ("sched: Optimize finish_lock_switch()")
Reported-by: Jing-Ting Wu <jing-ting.wu@mediatek.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Jing-Ting Wu <jing-ting.wu@mediatek.com>
Link: https://lkml.kernel.org/r/20220519134706.GH2578@worktop.programming.kicks-ass.net
2022-06-13 10:15:07 +02:00
..
Makefile
autogroup.c sched/autogroup: Fix sysctl move 2022-05-30 12:36:36 +02:00
autogroup.h
build_policy.c
build_utility.c
clock.c
completion.c
core.c sched: Fix balance_push() vs __sched_setscheduler() 2022-06-13 10:15:07 +02:00
core_sched.c
cpuacct.c
cpudeadline.c
cpudeadline.h
cpufreq.c
cpufreq_schedutil.c
cpupri.c
cpupri.h
cputime.c
deadline.c sysctl changes for v5.19-rc1 2022-05-26 16:57:20 -07:00
debug.c
fair.c This set of changes updates init and user mode helper tasks to be 2022-06-03 16:03:05 -07:00
features.h
idle.c Scheduler changes in this cycle were: 2022-05-24 11:11:13 -07:00
isolation.c
loadavg.c
membarrier.c
pelt.c
pelt.h
psi.c
rt.c sysctl changes for v5.19-rc1 2022-05-26 16:57:20 -07:00
sched-pelt.h
sched.h sched: Fix balance_push() vs __sched_setscheduler() 2022-06-13 10:15:07 +02:00
smp.h
stats.c
stats.h
stop_task.c
swait.c
topology.c
wait.c
wait_bit.c