History

sched_ext: Pass held rq to SCX_CALL_OP() for core_sched_before

scx_prio_less() runs from core-sched's pick_next_task() path with rq locked but invokes ops.core_sched_before() with NULL locked_rq, leaving scx_locked_rq_state NULL. If the BPF callback calls a kfunc that re-acquires rq based on scx_locked_rq() - e.g. scx_bpf_cpuperf_set(cpu) - it re-acquires the already-held rq. Pass task_rq(a).

Tejun Heo committed 6 months ago

Commit 4155fb41 parent 207d76a1 file · +1 −1Browse files

Unified · Split

kernel/sched/ext.c+1−1
@@ -3198,7 +3198,7 @@ bool scx_prio_less(const struct task_struct *a, const struct task_struct *b, · 3197 unmodified lines
31983198 if (sch_a == sch_b && SCX_HAS_OP(sch_a, core_sched_before) &&
31993199 !scx_bypassing(sch_a, task_cpu(a)))
32003200 return SCX_CALL_OP_2TASKS_RET(sch_a, core_sched_before,
3201− NULL,
3201+ task_rq(a),
32023202 (struct task_struct *)a,
32033203 (struct task_struct *)b);
32043204 else