diff options
| author | Tejun Heo <tj@kernel.org> | 2026-03-06 20:58:03 +0300 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-03-06 20:58:03 +0300 |
| commit | d94d09a23340b343ffc6ad935f4a7fa90516684a (patch) | |
| tree | 532795f8ddd84b422fe58ecbdb99fa3d2e8aa0cf | |
| parent | 39d0b2c43776fc84a27b2fc37cebe89e442aafd8 (diff) | |
| download | linux-d94d09a23340b343ffc6ad935f4a7fa90516684a.tar.xz | |
sched_ext: When calling ops.dispatch() @prev must be on the same scx_sched
The @prev parameter passed into ops.dispatch() is expected to be on the
same sched. Passing in @prev which isn't on the sched can spuriously
trigger failures that can kill the scheduler. Pass in @prev iff it's on
the same sched.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
| -rw-r--r-- | kernel/sched/ext.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 28ac7ba3ece0..413d0558372f 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -2392,9 +2392,10 @@ static bool scx_dispatch_sched(struct scx_sched *sch, struct rq *rq, struct task_struct *prev) { struct scx_dsp_ctx *dspc = this_cpu_ptr(scx_dsp_ctx); - bool prev_on_scx = prev->sched_class == &ext_sched_class; int nr_loops = SCX_DSP_MAX_LOOPS; s32 cpu = cpu_of(rq); + bool prev_on_sch = (prev->sched_class == &ext_sched_class) && + scx_task_on_sched(sch, prev); if (consume_global_dsq(sch, rq)) return true; @@ -2418,7 +2419,7 @@ static bool scx_dispatch_sched(struct scx_sched *sch, struct rq *rq, dspc->nr_tasks = 0; SCX_CALL_OP(sch, SCX_KF_DISPATCH, dispatch, rq, cpu, - prev_on_scx ? prev : NULL); + prev_on_sch ? prev : NULL); flush_dispatch_buf(sch, rq); |
