]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sched_ext: switch class when preempted by higher priority scheduler
authorHonglei Wang <jameshongleiwang@126.com>
Wed, 8 Jan 2025 02:33:28 +0000 (10:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2025 12:40:49 +0000 (13:40 +0100)
[ Upstream commit 68e449d849fd50bd5e61d8bd32b3458dbd3a3df6 ]

ops.cpu_release() function, if defined, must be invoked when preempted by
a higher priority scheduler class task. This scenario was skipped in
commit f422316d7466 ("sched_ext: Remove switch_class_scx()"). Let's fix
it.

Fixes: f422316d7466 ("sched_ext: Remove switch_class_scx()")
Signed-off-by: Honglei Wang <jameshongleiwang@126.com>
Acked-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/sched/ext.c

index 81235942555a2a8854440b3668e8035bb1806cdc..f3ca1a88375c28cde6310c4145bdb0f1b533e3e4 100644 (file)
@@ -2917,7 +2917,7 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
                 */
                if (p->scx.slice && !scx_rq_bypassing(rq)) {
                        dispatch_enqueue(&rq->scx.local_dsq, p, SCX_ENQ_HEAD);
-                       return;
+                       goto switch_class;
                }
 
                /*
@@ -2934,6 +2934,7 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
                }
        }
 
+switch_class:
        if (next && next->sched_class != &ext_sched_class)
                switch_class(rq, next);
 }