[PATCH 2/3] sched_ext: Use irq_work for deferred actions with proxy execution
From: Andrea Righi
Date: Tue Oct 20 2026 - 04:51:49 EST
maybe_queue_balance_callback() clears SCX_RQ_BAL_CB_PENDING when it
queues the deferred callback. Proxy resolution can then zap the callback
without running it, leaving the deferred actions unscheduled until a
later wakeup or deferred request.
Use the existing irq_work fallback for dispatch-time deferred requests
when proxy execution is enabled. This keeps the work scheduled even if
proxy resolution retries the pick or falls back to idle, without relying
on another SCX dispatch to restore a discarded callback.
Fixes: a8ad873113d3 ("sched_ext: defer queue_balance_callback() until after ops.dispatch")
Reported-by: Tejun Heo <tj@xxxxxxxxxx>
Link: https://lore.kernel.org/r/08cac02c604dd73ef96fc92eb29d692b@xxxxxxxxxx
Signed-off-by: Andrea Righi <arighi@xxxxxxxxxx>
---
kernel/sched/ext/ext.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 5efc3ad1b1198..4b7d2602b4d40 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -1129,9 +1129,10 @@ static void schedule_deferred_locked(struct rq *rq)
return;
/*
- * If in dispatch, the balance callbacks will be called before rq lock
- * is released. Schedule one.
- *
+ * If in dispatch without proxy execution, the balance callbacks will
+ * be called before rq lock is released. Schedule one. With proxy
+ * execution, proxy resolution can zap the callbacks without another
+ * SCX dispatch to requeue them, so use irq_work instead.
*
* We can't directly insert the callback into the
* rq's list: The call can drop its lock and make the pending balance
@@ -1139,7 +1140,7 @@ static void schedule_deferred_locked(struct rq *rq)
*
* Just let dispatch_one() know that it must do it itself.
*/
- if (rq->scx.flags & SCX_RQ_IN_DISPATCH) {
+ if ((rq->scx.flags & SCX_RQ_IN_DISPATCH) && !sched_proxy_exec()) {
rq->scx.flags |= SCX_RQ_BAL_CB_PENDING;
return;
}
--
2.56.0