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

From: Kuba Piecuch

Date: Fri Mar 20 2026 - 13:00:47 EST


On Fri Mar 20, 2026 at 1:56 PM UTC, Kuba Piecuch wrote:
> This prompted me to have a look at the logic around SCX_OPSS_QUEUED and I can't
> convince myself that it's correct in the case of direct dispatches to
> non-builtin DSQs.
>
> The only place where ops_state is set to QUEUED is at the end of
> do_enqueue_task(). Notably, this assignment is skipped in the case of direct
> dispatch.
>
> direct_dispatch() will then call dispatch_enqueue() with SCX_ENQ_CLEAR_OPSS,
> causing ops_state to be reset to NONE. We end up in a state where the task
> is enqueued on a user DSQ, its ops_state is NONE and p->scx.flags has
> SCX_TASK_IN_CUSTODY, which doesn't look like a consistent state to me.
>
> Am I missing something here?

I just saw the comment in ops_dequeue() introduced by your ops.dequeue()
patchset, so I guess this is WAI. Please disregard this comment.