Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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).

Fixes: 7b0888b7cc19 ("sched_ext: Implement core-sched support")
Cc: stable@vger.kernel.org # v6.12+
Reported-by: Chris Mason <clm@meta.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>

+1 -1
+1 -1
kernel/sched/ext.c
··· 3198 3198 if (sch_a == sch_b && SCX_HAS_OP(sch_a, core_sched_before) && 3199 3199 !scx_bypassing(sch_a, task_cpu(a))) 3200 3200 return SCX_CALL_OP_2TASKS_RET(sch_a, core_sched_before, 3201 - NULL, 3201 + task_rq(a), 3202 3202 (struct task_struct *)a, 3203 3203 (struct task_struct *)b); 3204 3204 else