Skip to contentSkip to conversation

sched_ext: Avoid relocking DSQ during remote DSQ moves

PATCH Applied Usama Arif 2 participants 2 messages Sep 23

Subsystems (3)
lore
Share & tools
lore

Usama Arif

author
#0 lore raw

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.

---
 kernel/sched/ext/ext.c | 1 +
 1 file changed, 1 insertion(+)
kernel/sched/ext/ext.c +1 -0
index f95d1cf8d3d1c..56bc06a56bb34 100644
@@ -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
reviewer Applied
#1 lore raw

Applied to sched_ext/for-7.4 with the context adjusted (the patch was against for-next).

Thanks.

--
tejun