]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched_ext: Avoid live-locking bypass mode switching
authorTejun Heo <tj@kernel.org>
Tue, 5 Nov 2024 21:48:11 +0000 (11:48 -1000)
committerTejun Heo <tj@kernel.org>
Fri, 8 Nov 2024 20:42:13 +0000 (10:42 -1000)
commit62dcbab8b0ef21729532600039fd514c09407092
tree916f51fa69c1ccaec9d29e37657d4573115508d8
parentf07b806ad8ebcca0a25738b78557736ef9674797
sched_ext: Avoid live-locking bypass mode switching

A poorly behaving BPF scheduler can live-lock the system by e.g. incessantly
banging on the same DSQ on a large NUMA system to the point where switching
to the bypass mode can take a long time. Turning on the bypass mode requires
dequeueing and re-enqueueing currently runnable tasks, if the DSQs that they
are on are live-locked, this can take tens of seconds cascading into other
failures. This was observed on 2 x Intel Sapphire Rapids machines with 224
logical CPUs.

Inject artifical delays while the bypass mode is switching to guarantee
timely completion.

While at it, move __scx_ops_bypass_lock into scx_ops_bypass() and rename it
to bypass_lock.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Valentin Andrei <vandrei@meta.com>
Reported-by: Patrick Lu <patlu@meta.com>
kernel/sched/ext.c