Re: [PATCH 04/12] sched_ext: Block proxy donors across scheduler transitions

From: Tejun Heo

Date: Wed Jul 22 2026 - 19:36:01 EST


Hello, Andrea.

On Tue, Jul 21, 2026 at 08:31:25AM +0200, Andrea Righi wrote:
> @@ -7168,7 +7168,8 @@ static void __sched notrace __schedule(int sched_mode)
> * task_is_blocked() will always be false).
> */
> try_to_block_task(rq, prev, &prev_state,
> - !task_is_blocked(prev));
> + !task_is_blocked(prev) ||
> + !scx_allow_proxy_exec(prev));

The condition fits on one line.

> @@ -7721,6 +7722,8 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task)
> if (prev_class != next_class)
> queue_flag |= DEQUEUE_CLASS;
>
> + scx_prepare_setscheduler(p, next_class);
> +
> scoped_guard (sched_change, p, queue_flag) {

Calling directly into sched_ext from rt_mutex_setprio() and
__sched_setscheduler() isn't the prettiest. This may want to be a class
callback invoked from sched_change_begin() on the incoming class before the
queued state is recorded - the existing ones are either too late or on the
outgoing class.

Peter, what do you think?

> +void scx_prepare_setscheduler(struct task_struct *p,
> + const struct sched_class *next_class)

Fits on one line. Ditto for the declaration in ext.h.

Thanks.

--
tejun