summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/sched/ext.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index f0c9823915c6..c04fc6e3ddb4 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -3998,30 +3998,22 @@ static void scx_ops_disable_workfn(struct kthread_work *work)
spin_lock_irq(&scx_tasks_lock);
scx_task_iter_init(&sti);
/*
- * Invoke scx_ops_exit_task() on all non-idle tasks, including
- * TASK_DEAD tasks. Because dead tasks may have a nonzero refcount,
- * we may not have invoked sched_ext_free() on them by the time a
- * scheduler is disabled. We must therefore exit the task here, or we'd
- * fail to invoke ops.exit_task(), as the scheduler will have been
- * unloaded by the time the task is subsequently exited on the
- * sched_ext_free() path.
+ * The BPF scheduler is going away. All tasks including %TASK_DEAD ones
+ * must be switched out and exited synchronously.
*/
while ((p = scx_task_iter_next_locked(&sti, true))) {
const struct sched_class *old_class = p->sched_class;
struct sched_enq_and_set_ctx ctx;
- if (READ_ONCE(p->__state) != TASK_DEAD) {
- sched_deq_and_put_task(p, DEQUEUE_SAVE | DEQUEUE_MOVE,
- &ctx);
+ sched_deq_and_put_task(p, DEQUEUE_SAVE | DEQUEUE_MOVE, &ctx);
- p->scx.slice = min_t(u64, p->scx.slice, SCX_SLICE_DFL);
- __setscheduler_prio(p, p->prio);
- check_class_changing(task_rq(p), p, old_class);
+ p->scx.slice = min_t(u64, p->scx.slice, SCX_SLICE_DFL);
+ __setscheduler_prio(p, p->prio);
+ check_class_changing(task_rq(p), p, old_class);
- sched_enq_and_set_task(&ctx);
+ sched_enq_and_set_task(&ctx);
- check_class_changed(task_rq(p), p, old_class, p->prio);
- }
+ check_class_changed(task_rq(p), p, old_class, p->prio);
scx_ops_exit_task(p);
}
scx_task_iter_exit(&sti);