]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
sched_ext: ops.cpu_acquire() should be called with SCX_KF_REST
authorTejun Heo <tj@kernel.org>
Thu, 14 Nov 2024 18:50:58 +0000 (08:50 -1000)
committerTejun Heo <tj@kernel.org>
Thu, 14 Nov 2024 18:50:58 +0000 (08:50 -1000)
ops.cpu_acquire() is currently called with 0 kf_maks which is interpreted as
SCX_KF_UNLOCKED which allows all unlocked kfuncs, but ops.cpu_acquire() is
called from balance_one() under the rq lock and should only be allowed call
kfuncs that are safe under the rq lock. Update it to use SCX_KF_REST.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>
Cc: Zhao Mengmeng <zhaomzhao@126.com>
Link: http://lkml.kernel.org/r/ZzYvf2L3rlmjuKzh@slm.duckdns.org
Fixes: 245254f7081d ("sched_ext: Implement sched_ext_ops.cpu_acquire/release()")
kernel/sched/ext.c

index 19f9cb3a4190a1864faa6b897d5f0ab8cdef4134..1ae8520b63ddb73c7ea594eccaedc5ebd80508e6 100644 (file)
@@ -2645,7 +2645,7 @@ static int balance_one(struct rq *rq, struct task_struct *prev)
                 * emitted in scx_next_task_picked().
                 */
                if (SCX_HAS_OP(cpu_acquire))
-                       SCX_CALL_OP(0, cpu_acquire, cpu_of(rq), NULL);
+                       SCX_CALL_OP(SCX_KF_REST, cpu_acquire, cpu_of(rq), NULL);
                rq->scx.cpu_released = false;
        }