sched_ext: Avoid relocking DSQ during remote DSQ moves
Subsystems (3)
PATCH 1/1 sched_ext: Avoid relocking DSQ during remote DSQ moves
When scx_bpf_dsq_move*() moves a task from a non-local DSQ to a remote local DSQ, move_task_between_dsqs() drops src_dsq->lock while leaving p->scx.dsq set. The following deactivate_task() then reacquires src_dsq->lock in scx_dispatch_dequeue() to unlink the task and clear p->scx.dsq.
Both the source rq and src_dsq are already locked before the source DSQ lock is dropped. Call dispatch_dequeue_locked() there so that deactivate_task() takes the !dsq path and avoids the redundant lock acquisition.
Suggested-by Tejun Heo <[email protected]>
Signed-off-by Usama Arif <[email protected]>
--- kernel/sched/ext/ext.c | 1 + 1 file changed, 1 insertion(+)
kernel/sched/ext/ext.c +1 -0
@@ -2710,6 +2710,7 @@ static struct rq *move_task_between_dsqs(struct scx_sched *sch,raw_spin_unlock (&src_dsq->lock);scx_move_local_task_to_local_dsq (sch, p, enq_flags, dst_rq); }else { +dispatch_dequeue_locked (p, src_dsq);raw_spin_unlock (&src_dsq->lock);move_remote_task_to_local_dsq (sch, p, enq_flags, src_rq, dst_rq); }
Signature · 1 line
2.53.0-Meta
Applied to sched_ext/for-7.4 with the context adjusted (the patch was against for-next).
Thanks.
--
tejun