Commit 61eeb9a
committed
sched_ext: TASK_DEAD tasks must be switched out of SCX on ops_disable
scx_ops_disable_workfn() only switches !TASK_DEAD tasks out of SCX while
calling scx_ops_exit_task() on all tasks including dead ones. This can leave
a dead task on SCX but with SCX_TASK_NONE state, which is inconsistent.
If another task was in the process of changing the TASK_DEAD task's
scheduling class and grabs the rq lock after scx_ops_disable_workfn() is
done with the task, the task ends up calling scx_ops_disable_task() on the
dead task which is in an inconsistent state triggering a warning:
WARNING: CPU: 6 PID: 3316 at kernel/sched/ext.c:3411 scx_ops_disable_task+0x12c/0x160
...
RIP: 0010:scx_ops_disable_task+0x12c/0x160
...
Call Trace:
<TASK>
check_class_changed+0x2c/0x70
__sched_setscheduler+0x8a0/0xa50
do_sched_setscheduler+0x104/0x1c0
__x64_sys_sched_setscheduler+0x18/0x30
do_syscall_64+0x7b/0x140
entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7f140d70ea5b
There is no reason to leave dead tasks on SCX when unloading the BPF
scheduler. Fix by making scx_ops_disable_workfn() eject all tasks including
the dead ones from SCX.
Signed-off-by: Tejun Heo <[email protected]>1 parent 37cb049 commit 61eeb9a
1 file changed
+8
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3998 | 3998 | | |
3999 | 3999 | | |
4000 | 4000 | | |
4001 | | - | |
4002 | | - | |
4003 | | - | |
4004 | | - | |
4005 | | - | |
4006 | | - | |
4007 | | - | |
| 4001 | + | |
| 4002 | + | |
4008 | 4003 | | |
4009 | 4004 | | |
4010 | 4005 | | |
4011 | 4006 | | |
4012 | 4007 | | |
4013 | | - | |
4014 | | - | |
4015 | | - | |
| 4008 | + | |
4016 | 4009 | | |
4017 | | - | |
4018 | | - | |
4019 | | - | |
| 4010 | + | |
| 4011 | + | |
| 4012 | + | |
4020 | 4013 | | |
4021 | | - | |
| 4014 | + | |
4022 | 4015 | | |
4023 | | - | |
4024 | | - | |
| 4016 | + | |
4025 | 4017 | | |
4026 | 4018 | | |
4027 | 4019 | | |
| |||
0 commit comments