Re: [PATCH 1/2] sched_ext: Fix ops.dequeue() semantics

From: Tejun Heo

Date: Tue Feb 10 2026 - 18:54:48 EST


One more comment.

On Tue, Feb 10, 2026 at 10:26:04PM +0100, Andrea Righi wrote:
> @@ -1407,13 +1446,19 @@ static void do_enqueue_task(struct rq *rq, struct task_struct *p, u64 enq_flags,
> * dequeue may be waiting. The store_release matches their load_acquire.
> */
> atomic_long_set_release(&p->scx.ops_state, SCX_OPSS_QUEUED | qseq);
> +
> + /*
> + * Task is now in BPF scheduler's custody. Set %SCX_TASK_IN_CUSTODY
> + * so ops.dequeue() is called when it leaves custody.
> + */
> + p->scx.flags |= SCX_TASK_IN_CUSTODY;

As this is protected by task's rq lock, doing it here is okay but can you
move this above atomic_long_set_release()? That's conceptually more
straightforward as that set_release() is supposed to be the "I'm done with
this task" point.

Thanks.

--
tejun