diff options
| author | Hang Zhengyang <hang.zhengyang1010@gmail.com> | 2026-11-23 02:04:54 +0800 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-11-24 22:48:52 -1000 |
| commit | 97e1c7d467d07734f8f5c8c64730e1f7c415bd46 (patch) | |
| tree | 02ce4064e763cf4f2d8a6f9cf0e1d9b116297a9a /tools/perf/scripts/python/bin | |
| parent | ed42314d3e76b3142a2bb656e53e5b1d68c4a6ae (diff) | |
sched_ext: Attach fair_server before tasks fall back to fair on disable
In full mode, the enable path detaches fair_server, since no task runs
in the fair class. scx_root_disable() attaches it again only at the end,
in the dl_server_swap_bw() loop. But tasks fall back to fair well before
that. New forks and sched_setscheduler() calls do so once
scx_switching_all is cleared, and the switch loop moves all other tasks.
Until the swap, fair_server can't start, so an RT task that keeps a CPU
starves the fair tasks there.
Meanwhile, the disable path waits for RCU grace periods in
percpu_down_write() of scx_fork_rwsem and scx_cgroup_ops_rwsem. A grace
period can wait for a starved task, so the disable doesn't finish until
the RT task stops. The starved task can be a reader preempted under
PREEMPT_RCU, or the grace-period kthread itself. While the disable waits
in the scx_cgroup_lock() after the switch loop, scx_fork_rwsem and
cgroup_mutex are held, so forks wait too.
To reproduce, load scx_simple, pin SCHED_NORMAL tasks (/proc walkers,
stress-ng --fork) and a SCHED_FIFO spinner to CPU 1, and unload the
scheduler 50 ms after the spinner starts. The disable can then get
stuck in:
synchronize_rcu_normal+0x1da/0x1f0
rcu_sync_enter+0x56/0x140
scx_root_disable+0x230/0x420
kthread_worker_fn+0xf0/0x270
until the spinner stops.
Attach fair_server before tasks start to fall back, the same way the
enable path attaches ext_server before tasks switch to it. If the root
domain can't fit both servers, the swap attaches fair_server as before.
Fixes: e7b63427fdb4 ("sched_ext: Auto-register/unregister dl_server reservations")
Cc: stable@vger.kernel.org # v7.2+
Signed-off-by: Hang Zhengyang <hang.zhengyang1010@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
