Re: [PATCH] sched_ext: Fix spurious WARN on stale ops_state in ops_dequeue()

From: Samuele Mariotti

Date: Fri May 15 2026 - 06:18:09 EST


Hello Andrea,

On 14/05/2026 22:08, Andrea Righi wrote:
...
The code looks good to me, I'd elaborate more on the comment to make it clear
that the retry loop is guaranteed to terminate (not a deadlock).

How about this (or something along these lines)?

/*
* A queued task must be in BPF scheduler's custody. If
* SCX_TASK_IN_CUSTODY is clear, finish_dispatch() on another
* CPU has already passed call_task_dequeue() (which clears the
* flag), but has not yet written SCX_OPSS_NONE. That final
* store does not require this rq's lock, so retrying with
* cpu_relax() is bounded: we'll observe NONE (or DISPATCHING,
* handled by the fallthrough) on a subsequent iteration.
*/

Thanks,
-Andrea

Agreed, the comment covers all the relevant aspects and explains the if
condition clearly. I would go with it.


Thanks,
Samuele