[PATCH 06/14] sched_ext: Block proxy donors across scheduler transitions

From: Andrea Righi

Date: Sat Jul 25 2026 - 12:08:32 EST


Proxy execution retains mutex-blocked donors on the runqueue so their
scheduling context can execute a lock owner. sched_ext cannot safely
retain such donors unless the BPF scheduler explicitly participates in
their admission and ordering.

Make sched_ext reject retained donors by default. Implement
scx_allow_proxy_exec() to force blocked EXT tasks through the regular
block path in schedule(), and fully deactivate a retained donor before
sched_setscheduler(), PI de-boosting, or global activation moves it into
the EXT class.

This is a preparatory change to support proxy execution with sched_ext.

Acked-by: John Stultz <jstultz@xxxxxxxxxx>
Signed-off-by: Andrea Righi <arighi@xxxxxxxxxx>
---
kernel/sched/ext/ext.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index c7a77cc914cd5..bd9a8c3a269af 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -26,7 +26,15 @@ DEFINE_RAW_SPINLOCK(scx_sched_lock);

bool scx_allow_proxy_exec(const struct task_struct *p)
{
- return true;
+ return p->sched_class != &ext_sched_class;
+}
+
+static void prepare_switch_scx(struct rq *rq, struct task_struct *p)
+{
+ lockdep_assert_held(&p->pi_lock);
+ lockdep_assert_rq_held(rq);
+
+ sched_proxy_block_task(task_rq(p), p);
}

/*
@@ -4731,6 +4739,7 @@ DEFINE_SCHED_CLASS(ext) = {

.task_tick = task_tick_scx,

+ .prepare_switch = prepare_switch_scx,
.switching_to = switching_to_scx,
.switched_from = switched_from_scx,
.switched_to = switched_to_scx,
--
2.55.0