Re: [RFC PATCH 1/2] sched_ext: Reenqueue IMMED tasks when a higher class wins the pick
From: Tejun Heo
Date: Mon Nov 30 2026 - 10:11:56 EST
Hello, Kuba.
On Mon, Nov 30, 2026 at 11:19:14AM +0000, Kuba Piecuch wrote:
> I kept it for latency. The wakeup-time reenqueue returns the IMMED tasks
> to the BPF scheduler right away through the deferred irq_work or balance
> callback, so they can be moved to another CPU while curr is still on its
> way to a preemption point. With only scx_settle_pick(), they wait on the
> local DSQ until curr actually schedules, which can take a while if curr
> is in a preempt-off or IRQ-off section.
This is just from reading the code and I could be wrong, but AFAICS there
are three cases where wakeup_preempt_scx() finds an IMMED task on the
local DSQ which doesn't already have a reenqueue scheduled:
1. The CPU is idle and hasn't picked the task which was just inserted.
2. The CPU is in dispatch.
3. The task was inserted with SCX_ENQ_PREEMPT or SCX_ENQ_PREEMPT_LAZY and
curr hasn't scheduled out yet.
In the first two, the CPU looks to be already on its way to the pick, so
I don't think there's much difference. In the last one, triggering from
wakeup_preempt_scx() may be a bit sooner, but that doesn't seem that
significant to me, especially given that the task was already waiting for
curr to schedule out, which is the latency the preempt path already
accepts. Am I missing something?
Thanks.
--
tejun