Re: [PATCH] sched_ext: Document task ownership state machine

From: Andrea Righi

Date: Wed Mar 04 2026 - 11:43:56 EST


On Wed, Mar 04, 2026 at 06:23:57AM -1000, Tejun Heo wrote:
> Hello,
>
> On Wed, Mar 04, 2026 at 04:33:43PM +0100, Andrea Righi wrote:
> > + * Task Ownership State Machine (sched_ext_entity->ops_state)
> > *
> > + * The sched_ext core uses this state machine to track task ownership
> > + * between the SCX core and the BPF scheduler. This allows the BPF
> > + * scheduler to dispatch tasks without strict ordering requirements, while
> > + * the SCX core safely rejects invalid dispatches.
> > *
> > + * State Transitions
> > *
> > + * .------------> NONE (owned by SCX core)
> > + * | | ^
> > + * | enqueue | | direct dispatch
> > + * | v |
> > + * | QUEUEING -------'
> > + * | |
> > + * | enqueue |
> > + * | completes |
> > + * | v
> > + * | QUEUED (owned by BPF scheduler)
> > + * | | ^
> > + * | dispatch | | affinity changed
> > + * | | | (dispatch aborts)
> > + * | v |
> > + * | DISPATCHING -----'
> > + * | |
> > + * | dispatch |
> > + * | completes |
> > + * `---------------'
>
> I don't think we transition tasks from DISPATCHING to QUEUED on affinity
> changes. Not yet anyway, right?

Ah, you're right! That transition was part of my invalidation patch, so I
had it in head, but it's not actually in the kernel (yet). :)

I'll remove it.

Thanks,
-Andrea