mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCHSET sched_ext/for-7.4] sched_ext: Add scx_bpf_dsq_reenq_task()
@ 2026-10-17 22:37 Tejun Heo
  2026-10-17 22:37 ` [PATCH 1/3] sched_ext: Factor out the rq lock switch of scx_dsq_move() Tejun Heo
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Tejun Heo @ 2026-10-17 22:37 UTC (permalink / raw)
  To: sched-ext
  Cc: David Vernet, Andrea Righi, Changwoo Min, Emil Tsalapatis,
	David Dai, linux-kernel, Tejun Heo

Hello,

A scheduler that loses the cpus serving a DSQ needs the tasks stranded on it
placed again, and only those. scx_bpf_dsq_reenq() re-enqueues the whole DSQ:
every task goes back through ops.enqueue() and is re-placed and reordered.
The only per-task primitive, scx_bpf_dsq_move(), is a placement decision,
not a re-enqueue. A sub-scheduler sweeping its DSQs after a cap revoke is
one such caller.

Patch 1 factors the rq lock switch out of scx_dsq_move() so that the new
kfunc can share it. Patch 2 adds scx_bpf_dsq_reenq_task(), which marks a
task from a DSQ iteration. When the iteration ends, the DSQ's deferred
re-enqueue walk is scheduled once and re-enqueues only the marked tasks, in
DSQ order with SCX_ENQ_REENQ. The other tasks keep their positions.

The kfunc locks the task's rq and the DSQ like scx_bpf_dsq_move() and is
callable from the same contexts. The mark is cleared when the task leaves
the DSQ, so a task consumed before the walk is not re-enqueued.

Patch 3 makes scx_qmap re-enqueue some of the tasks stranded on its shared
DSQs with the new kfunc instead of moving them to the rescue path, so that
both kfuncs are exercised. They go back through ops.enqueue(), which rescues
them, and the other queued tasks keep their places.

Based on sched_ext/for-7.4 (9c0af54cb49c).

This patchset contains the following 3 patches.

 0001 sched_ext: Factor out the rq lock switch of scx_dsq_move()
 0002 sched_ext: Add scx_bpf_dsq_reenq_task() to re-enqueue single tasks from a DSQ iteration
 0003 sched_ext: scx_qmap: Also re-enqueue stranded tasks with scx_bpf_dsq_reenq_task()

The patchset is also available in the following git branch:

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git dsq-reenq-task

diffstat follows. Thanks.

 include/linux/sched/ext.h                |   1 +
 kernel/sched/ext/ext.c                   | 142 ++++++++++++++++++++++++-------
 kernel/sched/ext/internal.h              |   2 +
 tools/sched_ext/include/scx/common.bpf.h |   1 +
 tools/sched_ext/include/scx/compat.bpf.h |   6 ++
 tools/sched_ext/scx_qmap.bpf.c           |  50 ++++++-----
 6 files changed, 153 insertions(+), 49 deletions(-)

--
tejun

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

end of thread, other threads:[~2026-10-18  6:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-17 22:37 [PATCHSET sched_ext/for-7.4] sched_ext: Add scx_bpf_dsq_reenq_task() Tejun Heo
2026-10-17 22:37 ` [PATCH 1/3] sched_ext: Factor out the rq lock switch of scx_dsq_move() Tejun Heo
2026-10-17 22:52   ` Andrea Righi
2026-10-17 22:37 ` [PATCH 2/3] sched_ext: Add scx_bpf_dsq_reenq_task() to re-enqueue single tasks from a DSQ iteration Tejun Heo
2026-10-17 23:01   ` Andrea Righi
2026-10-17 23:35   ` [PATCH v2 " Tejun Heo
2026-10-17 22:37 ` [PATCH 3/3] sched_ext: scx_qmap: Also re-enqueue stranded tasks with scx_bpf_dsq_reenq_task() Tejun Heo
2026-10-17 23:06   ` Andrea Righi
2026-10-17 23:35     ` Tejun Heo
2026-10-18  6:14       ` Andrea Righi
2026-10-17 23:43 ` [PATCHSET sched_ext/for-7.4] sched_ext: Add scx_bpf_dsq_reenq_task() 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®