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

From: Samuele Mariotti

Date: Thu May 14 2026 - 05:14:21 EST


Hi Tejun,

Let's not do the WARN and exit. We shouldn't get this wrong and if we get
this wrong, it's going to be obvious from lockup detectors. Can you please
add a comment explaining the retry condition tho?

Thanks.

--
tejun

Thanks for the feedback. If I understood correctly, you prefer no retry
limit, letting the lockup detectors catch any real bug. I also added
unlikely() since the stale case is by definition rare.

Here is the updated version:

/*
* If SCX_TASK_IN_CUSTODY is not set, opss is stale: finish_dispatch()
* has already claimed the task and cleared SCX_TASK_IN_CUSTODY. Retry
* to get a fresh view of p->scx.ops_state.
*/
if (unlikely(!(READ_ONCE(p->scx.flags) & SCX_TASK_IN_CUSTODY))) {
cpu_relax();
goto retry;
}

Let me know if this looks good to you.

Thanks,
Samuele