mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched_ext: Avoid relocking DSQ during remote DSQ moves
@ 2026-09-23 21:34 Usama Arif
  2026-09-23 23:27 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Usama Arif @ 2026-09-23 21:34 UTC (permalink / raw)
  To: arighi, bpf, bsegall, changwoo, dietmar.eggemann, etsal,
	juri.lelli, kprateek.nayak, linux-kernel, mgorman, mingo, peterz,
	rostedt, sched-ext, tj, vincent.guittot, void, vschneid,
	yphbchou0911
  Cc: Usama Arif

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 <tj@kernel.org>
Signed-off-by: Usama Arif <usama.arif@linux.dev>
---
 kernel/sched/ext/ext.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index f95d1cf8d3d1c..56bc06a56bb34 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -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);
 		}
-- 
2.53.0-Meta


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sched_ext: Avoid relocking DSQ during remote DSQ moves
  2026-09-23 21:34 [PATCH] sched_ext: Avoid relocking DSQ during remote DSQ moves Usama Arif
@ 2026-09-23 23:27 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2026-09-23 23:27 UTC (permalink / raw)
  To: Usama Arif
  Cc: arighi, bpf, bsegall, changwoo, dietmar.eggemann, etsal,
	juri.lelli, kprateek.nayak, linux-kernel, mgorman, mingo, peterz,
	rostedt, sched-ext, vincent.guittot, void, vschneid,
	yphbchou0911, emil, david.dai

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

Thanks.

--
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-23 23:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 21:34 [PATCH] sched_ext: Avoid relocking DSQ during remote DSQ moves Usama Arif
2026-09-23 23:27 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®