Re: [PATCH v2 sched_ext/for-7.3] sched_ext: Bound per-task reenqueues and eject the owning scheduler

From: Tejun Heo

Date: Sun Jul 26 2026 - 15:50:10 EST


Hello, Andrea.

On Sun, Jul 26, 2026 at 09:30:54AM +0200, Andrea Righi wrote:
> > + if (enq_flags & SCX_ENQ_REENQ) {
> > + if (++p->scx.reenq_cnt > 1)
> > + __scx_add_event(sch, SCX_EV_REENQ_REPEAT, 1);
>
> Should we consider only consecutive kernel-driven retry reenqueues here, rather
> than every reenqueue? IIUC, the paths we need to limit are SCX_TASK_REENQ_IMMED
> and SCX_TASK_REENQ_CAP.

I think triggering it on all reenqueues is fine. No matter what, if a task
is getting reenqueued hundreds of times without running, something is going
wrong.

> Should reenq_cnt also be cleared in scx_disable_task(), together with the other
> SCX-managed fields?
>
> Otherwise, the count can survive switching the task to another scheduling class,
> replacing the BPF scheduler, or rehoming it to another sub-scheduler and the
> next owner could then be ejected based on the reenqueues from to the previous
> owner.

Yeah, that makes sense. Updated in v3.

> Documentation/scheduler/sched-ext.rst still uses SCX_EV_REENQ_LOCAL_REPEAT in
> both the sample events output and the counter description.
>
> The description also says that the event is specific to local DSQ reenqueues,
> while SCX_EV_REENQ_REPEAT now covers reenqueues from all sources. Can you update
> those two references as well?

Updated in v3.

Thanks.

--
tejun