* [PATCHSET sched_ext/for-7.5] sched/proxy: Handle retained donors on scheduling class transitions
@ 2026-11-26 11:13 Andrea Righi
2026-11-26 11:13 ` [PATCH 1/4] sched: Let switching_to() decide whether to keep a retained proxy donor Andrea Righi
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Andrea Righi @ 2026-11-26 11:13 UTC (permalink / raw)
To: Peter Zijlstra, Tejun Heo
Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
K Prateek Nayak, John Stultz, David Vernet, Changwoo Min, Tao Cui,
sched-ext, linux-kernel
Proxy execution keeps mutex-blocked donors on the runqueue. A BPF
scheduler with SCX_OPS_ENQ_BLOCKED admits donors that block while it
owns them, but sched_ext is not currently designed to pass it donors
retained elsewhere, regardless of SCX_OPS_ENQ_BLOCKED. To enforce this,
explicit hooks at the entry points into sched_ext block a retained donor
before sched_change_begin() records its queued state.
Tao Cui reported [1] that rt_mutex_setprio() has no such hook: an EXT
task that is PI-boosted into RT/DL and blocks on a second mutex while
boosted is retained by RT/DL, and when the boost goes away it is handed
back to sched_ext as a queued blocked donor that the BPF scheduler never
admitted.
The same can happen in __sched_setscheduler(). It calls
scx_prepare_setscheduler() to block a retained donor, but only when the
requested policy is SCHED_EXT. When the BPF scheduler takes over all
tasks (no SCX_OPS_SWITCH_PARTIAL), switching an RT/DL task to
SCHED_NORMAL, e.g., via sched_setscheduler(2) or sysrq-n, also moves it
into EXT without blocking the donor. In both cases, a BPF scheduler
without SCX_OPS_ENQ_BLOCKED receives a queued blocked donor it never
admitted: the donor is enqueued without SCX_ENQ_BLOCKED and, once
picked, proxy execution runs the mutex owner on its behalf, even though
the BPF scheduler opted out of it.
As suggested by Peter [2], instead of adding more hooks, let the
incoming class decide: switching_to() now returns whether the class
accepts a retained proxy donor, and sched_change_end() blocks the task
when it doesn't. This handles every class transition into sched_ext,
including PI deboost, and replaces the existing explicit hooks.
Moreover, moving a task between BPF schedulers (sub-sched enable,
rehome, punt) doesn't change its sched_class, so switching_to() doesn't
run there. Rather than keeping a separate hook for these paths, make
SCX_OPS_ENQ_BLOCKED a property of the whole hierarchy: a sub-scheduler
must match the root scheduler's setting or it fails to load, as also
suggested by Peter [3]. This makes the remaining scx-specific donor
blocking, and sched_proxy_block_task(), unnecessary.
Behavior change: a BPF scheduler with SCX_OPS_ENQ_BLOCKED now inherits
retained donors on class entry instead of having them blocked. A queued
donor is passed to ops.enqueue() with SCX_ENQ_BLOCKED as soon as the
scheduler isn't bypassing. The current donor, like any running task
entering sched_ext, keeps running without going through ops.enqueue(),
and gets SCX_ENQ_BLOCKED the next time it does.
Git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arighi/linux.git scx-proxy-donors
Peter, should we route this through the sched_ext tree or would you
prefer that I rebase it onto tip/sched/core?
Thanks,
-Andrea
[1] https://lore.kernel.org/r/20261112144935.583937-3-cui.tao@linux.dev
[2] https://lore.kernel.org/r/20261112160136.GF1922751@noisy.programming.kicks-ass.net
[3] https://lore.kernel.org/r/20261112164149.GE1813469@noisy.programming.kicks-ass.net
Andrea Righi (4):
sched: Let switching_to() decide whether to keep a retained proxy donor
sched_ext: Make SCX_OPS_ENQ_BLOCKED a hierarchy-wide setting
sched: Remove sched_proxy_block_task()
selftests/sched_ext: Check that blocked donors are never enqueued unadmitted
kernel/sched/core.c | 118 ++++++++++++++-------
kernel/sched/ext/ext.c | 78 +++++---------
kernel/sched/ext/ext.h | 2 -
kernel/sched/ext/internal.h | 4 +-
kernel/sched/ext/sub.c | 12 +--
kernel/sched/idle.c | 2 +-
kernel/sched/sched.h | 16 +--
kernel/sched/stop_task.c | 2 +-
kernel/sched/syscalls.c | 2 -
tools/sched_ext/include/scx/enum_defs.autogen.h | 1 -
tools/sched_ext/include/scx/enums_abi.autogen.h | 1 -
tools/sched_ext/scx_qmap.c | 2 +-
.../testing/selftests/sched_ext/enq_blocked.bpf.c | 9 ++
tools/testing/selftests/sched_ext/enq_blocked.c | 18 +++-
14 files changed, 149 insertions(+), 118 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] sched: Let switching_to() decide whether to keep a retained proxy donor
2026-11-26 11:13 [PATCHSET sched_ext/for-7.5] sched/proxy: Handle retained donors on scheduling class transitions Andrea Righi
@ 2026-11-26 11:13 ` Andrea Righi
2026-11-26 16:01 ` Peter Zijlstra
2026-11-26 11:13 ` [PATCH 2/4] sched_ext: Make SCX_OPS_ENQ_BLOCKED a hierarchy-wide setting Andrea Righi
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Andrea Righi @ 2026-11-26 11:13 UTC (permalink / raw)
To: Peter Zijlstra, Tejun Heo
Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
K Prateek Nayak, John Stultz, David Vernet, Changwoo Min, Tao Cui,
sched-ext, linux-kernel
Proxy execution retains mutex-blocked donors on the runqueue. A BPF
scheduler with SCX_OPS_ENQ_BLOCKED admits donors that block while it
owns them, but sched_ext is not currently designed to pass it donors
retained elsewhere, regardless of SCX_OPS_ENQ_BLOCKED. To enforce this,
explicit hooks in __sched_setscheduler() and in the root enable path
block a retained donor before sched_change_begin() records its queued
state.
These hooks don't cover every way into sched_ext. For example,
rt_mutex_setprio() has no such hook: an EXT task that is PI-boosted into
RT/DL and blocks on a second mutex while boosted is retained by RT/DL
and handed back to sched_ext as a queued blocked donor on deboost. The
__sched_setscheduler() hook also only triggers when the requested policy
is SCHED_EXT. When the BPF scheduler takes over all tasks (no
SCX_OPS_SWITCH_PARTIAL), switching an RT/DL task to SCHED_NORMAL, e.g.,
via sched_setscheduler(2) or sysrq-n, also moves it into EXT without
blocking the donor. In both cases, a BPF scheduler without
SCX_OPS_ENQ_BLOCKED receives a queued blocked donor it never admitted:
the donor is enqueued without SCX_ENQ_BLOCKED and, once picked, proxy
execution runs the mutex owner on its behalf, even though the BPF
scheduler opted out of it.
Rather than adding more hooks, let the incoming class decide: make
switching_to() return whether the class accepts a retained proxy donor.
When it doesn't, sched_change_end() blocks the task instead of
enqueueing it; sched_change_begin() already dequeued the task from its
old class, so finish the block without dequeueing it again: hand the
donor role back to rq->curr if needed, account the sleep and clear
p->on_rq. The callers hold p->pi_lock, so the task cannot be woken and
migrated underneath.
On the sched_ext side, switching_to_scx() refuses retained donors unless
the BPF scheduler admits them, which covers every class transition into
sched_ext, so the explicit hooks can go. The root enable path also drops
DEQUEUE_NOCLOCK, since the hook was the one updating the rq clock.
A BPF scheduler with SCX_OPS_ENQ_BLOCKED now inherits retained donors on
class entry instead of having them blocked. A queued donor is passed to
ops.enqueue() with SCX_ENQ_BLOCKED as soon as the scheduler isn't
bypassing. The current donor, like any running task entering sched_ext,
keeps running without going through ops.enqueue(), and gets
SCX_ENQ_BLOCKED the next time it does.
Update the enq_blocked selftest, which checked the donor state after
root enable, accordingly.
Fixes: be8be8acb268 ("sched_ext: Block proxy donors before taking control")
Reported-by: Tao Cui <cuitao@kylinos.cn>
Closes: https://lore.kernel.org/r/20261112144935.583937-3-cui.tao@linux.dev
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
---
kernel/sched/core.c | 90 +++++++++++++++++--
kernel/sched/ext/ext.c | 34 +++----
kernel/sched/ext/ext.h | 2 -
kernel/sched/idle.c | 2 +-
kernel/sched/sched.h | 9 +-
kernel/sched/stop_task.c | 2 +-
kernel/sched/syscalls.c | 2 -
.../testing/selftests/sched_ext/enq_blocked.c | 7 +-
8 files changed, 111 insertions(+), 37 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2f46922982f32..1b4ec78738861 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2252,15 +2252,19 @@ void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
dequeue_task(rq, p, flags);
}
+static inline bool task_state_contributes_to_load(unsigned long task_state)
+{
+ return (task_state & TASK_UNINTERRUPTIBLE) &&
+ !(task_state & TASK_NOLOAD) &&
+ !(task_state & TASK_FROZEN);
+}
+
static bool dequeue_block_task(struct rq *rq, struct task_struct *p,
unsigned long task_state)
{
int flags = DEQUEUE_NOCLOCK;
- p->sched_contributes_to_load =
- (task_state & TASK_UNINTERRUPTIBLE) &&
- !(task_state & TASK_NOLOAD) &&
- !(task_state & TASK_FROZEN);
+ p->sched_contributes_to_load = task_state_contributes_to_load(task_state);
if (unlikely(is_special_task_state(task_state)))
flags |= DEQUEUE_SPECIAL;
@@ -3772,6 +3776,17 @@ void update_rq_avg_idle(struct rq *rq)
rq->idle_stamp = 0;
}
+/*
+ * Make the execution context the donor again once the old donor has been put
+ * and rq->curr has been set as the next task.
+ */
+static inline void proxy_set_curr_donor(struct rq *rq)
+{
+ rq->next_class = rq->curr->sched_class;
+ rq_set_donor(rq, rq->curr);
+ resched_curr(rq);
+}
+
#ifdef CONFIG_SCHED_PROXY_EXEC
static void zap_balance_callbacks(struct rq *rq);
@@ -3780,10 +3795,8 @@ static inline void proxy_reset_donor(struct rq *rq)
WARN_ON_ONCE(rq->donor == rq->curr);
put_prev_set_next_task(rq, rq->donor, rq->curr);
- rq->next_class = rq->curr->sched_class;
- rq_set_donor(rq, rq->curr);
+ proxy_set_curr_donor(rq);
zap_balance_callbacks(rq);
- resched_curr(rq);
}
/*
@@ -11200,6 +11213,58 @@ struct sched_change_ctx *sched_change_begin(struct task_struct *p, unsigned int
return ctx;
}
+/*
+ * Block a mutex-blocked task retained on the rq for proxy execution, because
+ * the class it is switching to does not accept blocked tasks.
+ *
+ * sched_change_begin() already dequeued @p from its old class and put it if
+ * it was the donor, so finish the job a sleeping dequeue would have done
+ * without going through a class again.
+ *
+ * The caller holds p->pi_lock, so @p cannot wake and migrate once
+ * __block_task() clears p->on_rq.
+ */
+static void sched_change_block_task(struct rq *rq, struct sched_change_ctx *ctx)
+{
+ struct task_struct *p = ctx->p;
+ unsigned long state = READ_ONCE(p->__state);
+
+ lockdep_assert_held(&p->pi_lock);
+
+ if (WARN_ON_ONCE(state == TASK_RUNNING))
+ return;
+
+ /*
+ * Hand the donor role back to the execution context before clearing
+ * p->on_rq. This is proxy_reset_donor() without put_prev_task(), which
+ * sched_change_begin() already did, and without zapping the balance
+ * callbacks: nothing redoes them here, and they include the pull that
+ * switched_from_rt() or switched_from_dl() may have queued.
+ *
+ * If @p is rq->curr, __schedule() retained it and dropped the rq lock
+ * while picking. Block it like any prev that blocks in __schedule():
+ * keep it set, and let the pending pick put it.
+ */
+ if (ctx->running && rq->curr != p) {
+ struct task_struct *curr = rq->curr;
+
+ __put_prev_set_next_dl_server(rq, p, curr);
+ curr->sched_class->set_next_task(rq, curr, SNT_PICK);
+ proxy_set_curr_donor(rq);
+ ctx->running = false;
+ }
+
+ p->sched_contributes_to_load = task_state_contributes_to_load(state);
+
+ /* The DEQUEUE_SAVE in sched_change_begin() skipped these. */
+ sched_info_dequeue(rq, p);
+ psi_dequeue(p, DEQUEUE_SLEEP);
+
+ __block_task(rq, p);
+
+ ctx->queued = false;
+}
+
void sched_change_end(struct sched_change_ctx *ctx)
{
struct task_struct *p = ctx->p;
@@ -11212,8 +11277,15 @@ void sched_change_end(struct sched_change_ctx *ctx)
*/
WARN_ON_ONCE(p->sched_class != ctx->class && !(ctx->flags & ENQUEUE_CLASS));
- if ((ctx->flags & ENQUEUE_CLASS) && p->sched_class->switching_to)
- p->sched_class->switching_to(rq, p);
+ if ((ctx->flags & ENQUEUE_CLASS) && p->sched_class->switching_to) {
+ /*
+ * A class that refuses retained proxy donors gets @p blocked
+ * instead of enqueued, see struct sched_class::switching_to.
+ */
+ if (!p->sched_class->switching_to(rq, p) &&
+ ctx->queued && p->is_blocked)
+ sched_change_block_task(rq, ctx);
+ }
if (ctx->queued)
enqueue_task(rq, p, ctx->flags);
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index e3d1bb3fadd84..99038c2f6f4b0 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -4864,12 +4864,12 @@ static void prio_changed_scx(struct rq *rq, struct task_struct *p, u64 oldprio)
{
}
-static void switching_to_scx(struct rq *rq, struct task_struct *p)
+static bool switching_to_scx(struct rq *rq, struct task_struct *p)
{
struct scx_sched *sch = scx_task_sched(p);
if (task_dead_and_done(p))
- return;
+ return true;
scx_enable_task(sch, p);
@@ -4880,6 +4880,18 @@ static void switching_to_scx(struct rq *rq, struct task_struct *p)
*/
if (!scx_is_cid_type() && SCX_HAS_OP(sch, set_cpumask))
scx_call_op_set_cpumask(sch, rq, p, (struct cpumask *)p->cpus_ptr);
+
+ /*
+ * Don't carry a donor retained by another class into sched_ext unless
+ * the BPF scheduler admits blocked donors.
+ *
+ * If it does and @p is the current donor, @p keeps its running session:
+ * like any running task entering sched_ext, the ENQUEUE_RESTORE in
+ * sched_change_end() puts it straight into the local DSQ without
+ * ops.enqueue(). It only carries %SCX_ENQ_BLOCKED once it goes through
+ * ops.enqueue() while still blocked, e.g., when its slice runs out.
+ */
+ return scx_allow_proxy_exec(p);
}
static void switched_from_scx(struct rq *rq, struct task_struct *p)
@@ -4921,20 +4933,6 @@ int scx_check_setscheduler(struct task_struct *p, int policy)
return 0;
}
-/*
- * Don't carry a donor retained by another class into sched_ext. The caller
- * has updated the rq clock and invokes this immediately before
- * sched_change_begin() records the task's queued state.
- */
-void scx_prepare_setscheduler(struct task_struct *p, int policy)
-{
- lockdep_assert_held(&p->pi_lock);
- lockdep_assert_rq_held(task_rq(p));
-
- if (scx_enabled() && p->policy != policy && policy == SCHED_EXT)
- scx_block_proxy_donor(task_rq(p), p);
-}
-
static void process_ddsp_deferred_locals(struct rq *rq)
{
struct task_struct *p;
@@ -8641,10 +8639,6 @@ static void scx_root_enable_workfn(struct kthread_work *work)
if (old_class != new_class)
queue_flags |= DEQUEUE_CLASS;
- if (new_class == &ext_sched_class) {
- scx_prepare_task_sched_change(p);
- queue_flags |= DEQUEUE_NOCLOCK;
- }
scoped_guard (sched_change, p, queue_flags) {
scx_set_task_slice(p, READ_ONCE(sch->slice_dfl));
diff --git a/kernel/sched/ext/ext.h b/kernel/sched/ext/ext.h
index d32bc01071b01..f2b98b870f083 100644
--- a/kernel/sched/ext/ext.h
+++ b/kernel/sched/ext/ext.h
@@ -18,7 +18,6 @@ bool scx_can_stop_tick(struct rq *rq);
void scx_rq_activate(struct rq *rq);
void scx_rq_deactivate(struct rq *rq);
int scx_check_setscheduler(struct task_struct *p, int policy);
-void scx_prepare_setscheduler(struct task_struct *p, int policy);
bool task_should_scx(int policy);
bool scx_allow_ttwu_queue(const struct task_struct *p);
bool __scx_allow_proxy_exec(const struct task_struct *p);
@@ -71,7 +70,6 @@ static inline bool scx_can_stop_tick(struct rq *rq) { return true; }
static inline void scx_rq_activate(struct rq *rq) {}
static inline void scx_rq_deactivate(struct rq *rq) {}
static inline int scx_check_setscheduler(struct task_struct *p, int policy) { return 0; }
-static inline void scx_prepare_setscheduler(struct task_struct *p, int policy) {}
static inline bool task_on_scx(const struct task_struct *p) { return false; }
static inline bool scx_allow_ttwu_queue(const struct task_struct *p) { return true; }
static inline bool scx_allow_proxy_exec(const struct task_struct *p) { return true; }
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index 76f3c84ca6846..23217b91db03a 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -543,7 +543,7 @@ static void task_tick_idle(struct rq *rq, struct task_struct *curr, int queued)
update_curr_idle(rq);
}
-static void switching_to_idle(struct rq *rq, struct task_struct *p)
+static bool switching_to_idle(struct rq *rq, struct task_struct *p)
{
BUG();
}
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 9e7993256c817..11d38b2e18f05 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2775,10 +2775,17 @@ struct sched_class {
/*
* sched_change
+ *
+ * switching_to() is called with the rq lock held when @task enters
+ * this class, before it is enqueued. It returns whether the class
+ * accepts @task as a retained proxy donor, i.e., a mutex-blocked task
+ * that is still on the runqueue. If it returns false and @task is such
+ * a donor, sched_change_end() blocks @task instead of enqueueing it.
+ * Classes without switching_to() accept retained donors.
*/
void (*switching_from)(struct rq *this_rq, struct task_struct *task);
void (*switched_from) (struct rq *this_rq, struct task_struct *task);
- void (*switching_to) (struct rq *this_rq, struct task_struct *task);
+ bool (*switching_to) (struct rq *this_rq, struct task_struct *task);
void (*switched_to) (struct rq *this_rq, struct task_struct *task);
u64 (*get_prio) (struct rq *this_rq, struct task_struct *task);
void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
diff --git a/kernel/sched/stop_task.c b/kernel/sched/stop_task.c
index 1e0109ec36b3f..b7541bb7b5933 100644
--- a/kernel/sched/stop_task.c
+++ b/kernel/sched/stop_task.c
@@ -78,7 +78,7 @@ static void task_tick_stop(struct rq *rq, struct task_struct *curr, int queued)
{
}
-static void switching_to_stop(struct rq *rq, struct task_struct *p)
+static bool switching_to_stop(struct rq *rq, struct task_struct *p)
{
BUG(); /* its impossible to change to this class */
}
diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c
index 45a127deeadd9..b215b0ead9a60 100644
--- a/kernel/sched/syscalls.c
+++ b/kernel/sched/syscalls.c
@@ -678,8 +678,6 @@ int __sched_setscheduler(struct task_struct *p,
if (prev_class != next_class)
queue_flags |= DEQUEUE_CLASS;
- scx_prepare_setscheduler(p, policy);
-
scoped_guard (sched_change, p, queue_flags) {
if (!(attr->sched_flags & SCHED_FLAG_KEEP_PARAMS)) {
diff --git a/tools/testing/selftests/sched_ext/enq_blocked.c b/tools/testing/selftests/sched_ext/enq_blocked.c
index 1d5e090b54bc5..54ee5633c5720 100644
--- a/tools/testing/selftests/sched_ext/enq_blocked.c
+++ b/tools/testing/selftests/sched_ext/enq_blocked.c
@@ -624,8 +624,13 @@ static enum scx_test_status run_one(bool enq_blocked, bool cross_cpu,
goto out;
}
- /* Scheduler ownership changes start from a fully blocked donor. */
+ /*
+ * A scheduler that admits blocked donors inherits the retained donor,
+ * otherwise it must have been fully blocked on the way in.
+ */
donor_state = ENQ_BLOCKED_DONOR_SLEEPING;
+ if (enq_blocked)
+ donor_state |= ENQ_BLOCKED_DONOR_ON_RQ;
err = wait_for_donor_state(&thread_ctx, donor_state);
if (err < 0) {
SCX_ERR("Unexpected donor state after scheduler attachment (%d)",
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] sched_ext: Make SCX_OPS_ENQ_BLOCKED a hierarchy-wide setting
2026-11-26 11:13 [PATCHSET sched_ext/for-7.5] sched/proxy: Handle retained donors on scheduling class transitions Andrea Righi
2026-11-26 11:13 ` [PATCH 1/4] sched: Let switching_to() decide whether to keep a retained proxy donor Andrea Righi
@ 2026-11-26 11:13 ` Andrea Righi
2026-11-26 11:13 ` [PATCH 3/4] sched: Remove sched_proxy_block_task() Andrea Righi
2026-11-26 11:14 ` [PATCH 4/4] selftests/sched_ext: Check that blocked donors are never enqueued unadmitted Andrea Righi
3 siblings, 0 replies; 6+ messages in thread
From: Andrea Righi @ 2026-11-26 11:13 UTC (permalink / raw)
To: Peter Zijlstra, Tejun Heo
Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
K Prateek Nayak, John Stultz, David Vernet, Changwoo Min, Tao Cui,
sched-ext, linux-kernel
Moving a task between BPF schedulers (sub-sched enable, rehome and punt)
doesn't change its sched_class, so switching_to() doesn't run and can't
keep a scheduler that doesn't admit blocked donors from inheriting one.
scx_prepare_task_sched_change() works around this by blocking a retained
donor before every ownership change, even when both schedulers admit
blocked donors.
Mixing proxy donor admission within a hierarchy has no real use, so
don't allow it: a sub-scheduler must match the root scheduler's
SCX_OPS_ENQ_BLOCKED setting or it fails to load. Ownership changes then
can't affect donor admission: if the hierarchy doesn't admit blocked
donors, no EXT task is a retained donor; if it does, the incoming
scheduler accepts the donor just like on class entry.
Drop scx_prepare_task_sched_change() and the DEQUEUE_NOCLOCK it required
from the sub-sched paths. With that, sched_ext never blocks a donor that
it still owns, so scx_block_proxy_donor() and the SCX_RQ_PROXY_BLOCKING
special case in put_prev_task_scx() go away too.
Update the scx_qmap -X help text and drop SCX_RQ_PROXY_BLOCKING from the
generated enum headers.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
---
kernel/sched/ext/ext.c | 44 ++++++-------------
kernel/sched/ext/internal.h | 4 +-
kernel/sched/ext/sub.c | 12 ++---
kernel/sched/sched.h | 1 -
.../sched_ext/include/scx/enum_defs.autogen.h | 1 -
.../sched_ext/include/scx/enums_abi.autogen.h | 1 -
tools/sched_ext/scx_qmap.c | 2 +-
7 files changed, 20 insertions(+), 45 deletions(-)
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 99038c2f6f4b0..ecec827ad986b 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -24,17 +24,6 @@
DEFINE_RAW_SPINLOCK(scx_sched_lock);
-/*
- * Block a retained proxy donor, telling put_prev_task_scx() that the donor is
- * about to be dequeued and must not be reenqueued.
- */
-static void scx_block_proxy_donor(struct rq *rq, struct task_struct *p)
-{
- rq->scx.flags |= SCX_RQ_PROXY_BLOCKING;
- sched_proxy_block_task(rq, p);
- rq->scx.flags &= ~SCX_RQ_PROXY_BLOCKING;
-}
-
bool __scx_allow_proxy_exec(const struct task_struct *p)
{
struct scx_sched *sch;
@@ -46,21 +35,6 @@ bool __scx_allow_proxy_exec(const struct task_struct *p)
return !sch || (sch->ops.flags & SCX_OPS_ENQ_BLOCKED);
}
-/*
- * End retained proxy execution before changing @p's BPF scheduler ownership.
- * Called with @p's pi and rq locks held immediately before
- * sched_change_begin(). The caller must pass DEQUEUE_NOCLOCK so the rq clock
- * is updated only once.
- */
-void scx_prepare_task_sched_change(struct task_struct *p)
-{
- lockdep_assert_held(&p->pi_lock);
- lockdep_assert_rq_held(task_rq(p));
-
- update_rq_clock(task_rq(p));
- scx_block_proxy_donor(task_rq(p), p);
-}
-
/*
* NOTE: sched_ext is in the process of growing multiple scheduler support and
* scx_root usage is in a transitional state. Naked dereferences are safe if the
@@ -3596,7 +3570,6 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
struct scx_sched *sch = scx_task_sched(p);
bool proxy_put = p->is_blocked && next == rq->idle &&
(rq->scx.flags & SCX_RQ_PROXY_PENDING);
- bool proxy_block = rq->scx.flags & SCX_RQ_PROXY_BLOCKING;
bool rescue_keep = false;
rq->scx.flags &= ~SCX_RQ_PROXY_PENDING;
@@ -3624,15 +3597,12 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
if (next != p && (p->scx.flags & SCX_TASK_QUEUED) &&
(p->scx.flags & SCX_TASK_RUN_TRACKED)) {
if (SCX_HAS_OP(sch, stopping))
- SCX_CALL_OP_TASK(sch, stopping, rq, p, !proxy_block);
+ SCX_CALL_OP_TASK(sch, stopping, rq, p, true);
p->scx.flags &= ~SCX_TASK_RUN_TRACKED;
}
if (p->scx.flags & SCX_TASK_QUEUED) {
- if (proxy_block)
- goto switch_class;
-
set_task_runnable(rq, p);
/*
@@ -8246,6 +8216,18 @@ int scx_validate_ops(struct scx_sched *sch, const struct sched_ext_ops *ops)
return -EINVAL;
}
+ /*
+ * Proxy donor admission is a property of the whole hierarchy, so that
+ * moving a task between schedulers never changes whether a retained
+ * donor is admitted. Sub-scheds must follow the root scheduler.
+ */
+ if (scx_parent(sch) &&
+ (ops->flags & SCX_OPS_ENQ_BLOCKED) !=
+ (sch->ancestors[0]->ops.flags & SCX_OPS_ENQ_BLOCKED)) {
+ scx_error(sch, "SCX_OPS_ENQ_BLOCKED must match the root scheduler");
+ return -EINVAL;
+ }
+
/*
* SCX_OPS_TID_TO_TASK is enabled by the root scheduler. A sub-sched
* may set it to declare a dependency; reject if the root hasn't
diff --git a/kernel/sched/ext/internal.h b/kernel/sched/ext/internal.h
index c20326d6eed84..726cf4cee2c2a 100644
--- a/kernel/sched/ext/internal.h
+++ b/kernel/sched/ext/internal.h
@@ -240,6 +240,9 @@ enum scx_ops_flags {
*
* For blocked donors, this flag takes precedence over
* %SCX_OPS_ENQ_EXITING and %SCX_OPS_ENQ_MIGRATION_DISABLED.
+ *
+ * The root scheduler decides for the whole hierarchy. A sub-scheduler
+ * must match the root's setting or it fails to load.
*/
SCX_OPS_ENQ_BLOCKED = 1LLU << 10,
@@ -2296,7 +2299,6 @@ struct task_struct *scx_task_iter_next_locked(struct scx_task_iter *iter);
bool scx_set_task_slice(struct task_struct *p, u64 slice);
void scx_task_slice_ended(struct rq *rq, struct task_struct *p);
void scx_task_unlink_from_dsq(struct task_struct *p, struct scx_dispatch_q *dsq);
-void scx_prepare_task_sched_change(struct task_struct *p);
void scx_dispatch_dequeue(struct rq *rq, struct task_struct *p);
void scx_do_enqueue_task(struct rq *rq, struct task_struct *p, u64 enq_flags,
int sticky_cpu);
diff --git a/kernel/sched/ext/sub.c b/kernel/sched/ext/sub.c
index 9732809c09f89..e5b5098fa1e3d 100644
--- a/kernel/sched/ext/sub.c
+++ b/kernel/sched/ext/sub.c
@@ -1623,9 +1623,7 @@ static void scx_rehome_task(struct scx_sched *to, struct task_struct *p)
lockdep_assert_held(&p->pi_lock);
lockdep_assert_rq_held(task_rq(p));
- scx_prepare_task_sched_change(p);
- scoped_guard (sched_change, p,
- DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK) {
+ scoped_guard (sched_change, p, DEQUEUE_SAVE | DEQUEUE_MOVE) {
scx_disable_and_exit_task(scx_task_sched(p), p);
scx_set_task_state(p, SCX_TASK_INIT_BEGIN);
scx_set_task_state(p, SCX_TASK_INIT);
@@ -1655,9 +1653,7 @@ static void scx_punt_task(struct scx_sched *to, struct task_struct *p)
lockdep_assert_rq_held(task_rq(p));
WARN_ON_ONCE(!READ_ONCE(to->bypass_depth));
- scx_prepare_task_sched_change(p);
- scoped_guard (sched_change, p,
- DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK) {
+ scoped_guard (sched_change, p, DEQUEUE_SAVE | DEQUEUE_MOVE) {
scx_disable_and_exit_task(scx_task_sched(p), p);
scx_set_task_sched(p, to);
}
@@ -2434,9 +2430,7 @@ void scx_sub_enable_workfn(struct kthread_work *work)
if (!(p->scx.flags & SCX_TASK_SUB_INIT))
continue;
- scx_prepare_task_sched_change(p);
- scoped_guard (sched_change, p,
- DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK) {
+ scoped_guard (sched_change, p, DEQUEUE_SAVE | DEQUEUE_MOVE) {
/*
* $p must be either READY or ENABLED. If ENABLED,
* __scx_disabled_and_exit_task() first disables and
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 11d38b2e18f05..b34709723d861 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -803,7 +803,6 @@ enum scx_rq_flags {
SCX_RQ_PROXY_RETRY = 1 << 9, /* proxy-rejected tasks need retry */
SCX_RQ_PROXY_TICK = 1 << 10, /* proxy execution requires the tick */
SCX_RQ_PROXY_PENDING = 1 << 11, /* blocked donor awaits proxy resolution */
- SCX_RQ_PROXY_BLOCKING = 1 << 12, /* donor is being removed for sched change */
SCX_RQ_IN_WAKEUP = 1 << 16,
SCX_RQ_IN_DISPATCH = 1 << 17,
diff --git a/tools/sched_ext/include/scx/enum_defs.autogen.h b/tools/sched_ext/include/scx/enum_defs.autogen.h
index 27b45040c88ad..67aff283798af 100644
--- a/tools/sched_ext/include/scx/enum_defs.autogen.h
+++ b/tools/sched_ext/include/scx/enum_defs.autogen.h
@@ -208,7 +208,6 @@
#define HAVE_SCX_RQ_PROXY_RETRY
#define HAVE_SCX_RQ_PROXY_TICK
#define HAVE_SCX_RQ_PROXY_PENDING
-#define HAVE_SCX_RQ_PROXY_BLOCKING
#define HAVE_SCX_RQ_IN_WAKEUP
#define HAVE_SCX_RQ_IN_DISPATCH
#define HAVE_SCX_SCHED_PCPU_BYPASSING
diff --git a/tools/sched_ext/include/scx/enums_abi.autogen.h b/tools/sched_ext/include/scx/enums_abi.autogen.h
index 5cf54dcf5ffe1..18d69aa45538a 100644
--- a/tools/sched_ext/include/scx/enums_abi.autogen.h
+++ b/tools/sched_ext/include/scx/enums_abi.autogen.h
@@ -220,7 +220,6 @@ static const struct __scx_enum_abi_val __scx_enum_abi_vals[]
{ "scx_rq_flags", "SCX_RQ_PROXY_RETRY", 0x200LLU },
{ "scx_rq_flags", "SCX_RQ_PROXY_TICK", 0x400LLU },
{ "scx_rq_flags", "SCX_RQ_PROXY_PENDING", 0x800LLU },
- { "scx_rq_flags", "SCX_RQ_PROXY_BLOCKING", 0x1000LLU },
{ "scx_rq_flags", "SCX_RQ_IN_WAKEUP", 0x10000LLU },
{ "scx_rq_flags", "SCX_RQ_IN_DISPATCH", 0x20000LLU },
{ "scx_sched_pcpu_flags", "SCX_SCHED_PCPU_BYPASSING", 0x1LLU },
diff --git a/tools/sched_ext/scx_qmap.c b/tools/sched_ext/scx_qmap.c
index 414afb817e0a6..48cedf635d77f 100644
--- a/tools/sched_ext/scx_qmap.c
+++ b/tools/sched_ext/scx_qmap.c
@@ -65,7 +65,7 @@ const char help_fmt[] =
" -S Suppress qmap-specific debug dump\n"
" -p Switch only tasks on SCHED_EXT policy instead of all\n"
" -I Turn on SCX_OPS_ALWAYS_ENQ_IMMED\n"
-" -X Turn on SCX_OPS_ENQ_BLOCKED\n"
+" -X Turn on SCX_OPS_ENQ_BLOCKED, sub-schedulers must match the root\n"
" -F COUNT IMMED stress: force every COUNT'th enqueue to a busy local DSQ (use with -I)\n"
" -C MODE cid-override test (shuffle|bad-dup|bad-range|bad-mono)\n"
" -i SEC Stats interval, seconds (default 5)\n"
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] sched: Remove sched_proxy_block_task()
2026-11-26 11:13 [PATCHSET sched_ext/for-7.5] sched/proxy: Handle retained donors on scheduling class transitions Andrea Righi
2026-11-26 11:13 ` [PATCH 1/4] sched: Let switching_to() decide whether to keep a retained proxy donor Andrea Righi
2026-11-26 11:13 ` [PATCH 2/4] sched_ext: Make SCX_OPS_ENQ_BLOCKED a hierarchy-wide setting Andrea Righi
@ 2026-11-26 11:13 ` Andrea Righi
2026-11-26 11:14 ` [PATCH 4/4] selftests/sched_ext: Check that blocked donors are never enqueued unadmitted Andrea Righi
3 siblings, 0 replies; 6+ messages in thread
From: Andrea Righi @ 2026-11-26 11:13 UTC (permalink / raw)
To: Peter Zijlstra, Tejun Heo
Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
K Prateek Nayak, John Stultz, David Vernet, Changwoo Min, Tao Cui,
sched-ext, linux-kernel
sched_ext was the only user, and it now relies on switching_to()
refusing retained donors instead.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
---
kernel/sched/core.c | 28 ----------------------------
kernel/sched/sched.h | 6 ------
2 files changed, 34 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1b4ec78738861..4e05f6458a118 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6855,34 +6855,6 @@ static void proxy_deactivate(struct rq *rq, struct task_struct *donor)
block_task(rq, donor, state);
}
-/*
- * Remove a retained proxy donor before changing its scheduler ownership.
- * The caller holds p->pi_lock, so p cannot wake and migrate if block_task()
- * drops it from the runqueue. If DELAY_DEQUEUE keeps a blocked fair task
- * queued, switching_from_fair() completes the dequeue in the immediately
- * following sched_change_begin().
- */
-void sched_proxy_block_task(struct rq *rq, struct task_struct *p)
-{
- unsigned long state = READ_ONCE(p->__state);
-
- lockdep_assert_held(&p->pi_lock);
- lockdep_assert_rq_held(rq);
-
- if (!p->is_blocked || !task_on_rq_queued(p))
- return;
- if (WARN_ON_ONCE(state == TASK_RUNNING))
- return;
-
- if (task_current_donor(rq, p))
- proxy_reset_donor(rq);
-
- if (!p->se.sched_delayed)
- block_task(rq, p, state);
-
- WARN_ON_ONCE(task_on_rq_queued(p) && !p->se.sched_delayed);
-}
-
static inline void proxy_release_rq_lock(struct rq *rq, struct rq_flags *rf)
__releases(__rq_lockp(rq))
{
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index b34709723d861..36e0e28a34acd 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2534,12 +2534,6 @@ static inline bool task_is_blocked(struct task_struct *p)
return !!p->blocked_on;
}
-#ifdef CONFIG_SCHED_PROXY_EXEC
-void sched_proxy_block_task(struct rq *rq, struct task_struct *p);
-#else
-static inline void sched_proxy_block_task(struct rq *rq, struct task_struct *p) {}
-#endif
-
static inline int task_on_cpu(struct rq *rq, struct task_struct *p)
{
return p->on_cpu;
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] selftests/sched_ext: Check that blocked donors are never enqueued unadmitted
2026-11-26 11:13 [PATCHSET sched_ext/for-7.5] sched/proxy: Handle retained donors on scheduling class transitions Andrea Righi
` (2 preceding siblings ...)
2026-11-26 11:13 ` [PATCH 3/4] sched: Remove sched_proxy_block_task() Andrea Righi
@ 2026-11-26 11:14 ` Andrea Righi
3 siblings, 0 replies; 6+ messages in thread
From: Andrea Righi @ 2026-11-26 11:14 UTC (permalink / raw)
To: Peter Zijlstra, Tejun Heo
Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
K Prateek Nayak, John Stultz, David Vernet, Changwoo Min, Tao Cui,
sched-ext, linux-kernel
enq_blocked attaches the BPF scheduler while the fair class retains a
mutex-blocked donor, so the root enable moves the donor into sched_ext
through switching_to_scx(), the same path taken by every other class
transition into sched_ext, such as PI deboost or sched_setscheduler().
On top of the donor state checks, verify that ops.enqueue() never sees a
retained donor without SCX_ENQ_BLOCKED during the whole run, including
the scheduler attachment. A full wakeup enqueue happens before
is_blocked is cleared, so SCX_ENQ_WAKEUP enqueues are not counted.
Signed-off-by: Andrea Righi <arighi@nvidia.com>
---
tools/testing/selftests/sched_ext/enq_blocked.bpf.c | 9 +++++++++
tools/testing/selftests/sched_ext/enq_blocked.c | 11 +++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/sched_ext/enq_blocked.bpf.c b/tools/testing/selftests/sched_ext/enq_blocked.bpf.c
index 212690bf4e07b..72d562f16b694 100644
--- a/tools/testing/selftests/sched_ext/enq_blocked.bpf.c
+++ b/tools/testing/selftests/sched_ext/enq_blocked.bpf.c
@@ -20,6 +20,7 @@ u64 nr_blocked_enqueues_donor_cpu;
u64 nr_blocked_enqueues_owner_cpu;
u64 nr_blocked_enqueues_other_cpu;
u64 nr_blocked_wakeups;
+u64 nr_unadmitted_enqueues;
static u64 vtime_now;
UEI_DEFINE(uei);
@@ -34,6 +35,14 @@ void BPF_STRUCT_OPS(enq_blocked_enqueue, struct task_struct *p, u64 enq_flags)
{
u64 vtime = p->scx.dsq_vtime;
+ /*
+ * A retained proxy donor must only be enqueued with SCX_ENQ_BLOCKED. A
+ * full wakeup enqueue happens before is_blocked is cleared.
+ */
+ if (p->pid == donor_pid && p->is_blocked &&
+ !(enq_flags & (SCX_ENQ_BLOCKED | SCX_ENQ_WAKEUP)))
+ __sync_fetch_and_add(&nr_unadmitted_enqueues, 1);
+
if (enq_flags & SCX_ENQ_BLOCKED) {
int cpu = scx_bpf_task_cpu(p);
diff --git a/tools/testing/selftests/sched_ext/enq_blocked.c b/tools/testing/selftests/sched_ext/enq_blocked.c
index 54ee5633c5720..ec6ffb9625fb8 100644
--- a/tools/testing/selftests/sched_ext/enq_blocked.c
+++ b/tools/testing/selftests/sched_ext/enq_blocked.c
@@ -497,7 +497,7 @@ static enum scx_test_status run_one(bool enq_blocked, bool cross_cpu,
size_t i, nr_contenders, nr_contenders_started = 0;
size_t nr_contenders_joined = 0;
u64 nr_blocked, nr_blocked_donor_cpu, nr_blocked_owner_cpu;
- u64 nr_blocked_other_cpu, nr_blocked_wakeups;
+ u64 nr_blocked_other_cpu, nr_blocked_wakeups, nr_unadmitted;
struct enq_blocked_stats stats;
err = select_test_cpus(cross_cpu, &allowed_cpus, &thread_ctx.donor_cpu,
@@ -815,6 +815,7 @@ static enum scx_test_status run_one(bool enq_blocked, bool cross_cpu,
nr_blocked_owner_cpu = skel->bss->nr_blocked_enqueues_owner_cpu;
nr_blocked_other_cpu = skel->bss->nr_blocked_enqueues_other_cpu;
nr_blocked_wakeups = skel->bss->nr_blocked_wakeups;
+ nr_unadmitted = skel->bss->nr_unadmitted_enqueues;
result->nr_blocked_enqueues = nr_blocked;
result->nr_blocked_enqueues_donor_cpu = nr_blocked_donor_cpu;
result->nr_blocked_enqueues_owner_cpu = nr_blocked_owner_cpu;
@@ -830,8 +831,14 @@ static enum scx_test_status run_one(bool enq_blocked, bool cross_cpu,
(unsigned long long)nr_blocked_other_cpu);
printf(" nr_blocked_wakeups=%llu\n",
(unsigned long long)nr_blocked_wakeups);
+ printf(" nr_unadmitted_enqueues=%llu\n",
+ (unsigned long long)nr_unadmitted);
if (status == SCX_TEST_PASS) {
- if (enq_blocked && proxy_enabled && !nr_blocked) {
+ if (nr_unadmitted) {
+ SCX_ERR("ops.enqueue() received %llu blocked donors without SCX_ENQ_BLOCKED",
+ (unsigned long long)nr_unadmitted);
+ status = SCX_TEST_FAIL;
+ } else if (enq_blocked && proxy_enabled && !nr_blocked) {
SCX_ERR("ops.enqueue() did not receive the blocked donor");
status = SCX_TEST_FAIL;
} else if ((!enq_blocked || !proxy_enabled) && nr_blocked) {
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/4] sched: Let switching_to() decide whether to keep a retained proxy donor
2026-11-26 11:13 ` [PATCH 1/4] sched: Let switching_to() decide whether to keep a retained proxy donor Andrea Righi
@ 2026-11-26 16:01 ` Peter Zijlstra
0 siblings, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2026-11-26 16:01 UTC (permalink / raw)
To: Andrea Righi
Cc: Tejun Heo, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak, John Stultz, David Vernet,
Changwoo Min, Tao Cui, sched-ext, linux-kernel
On Thu, Nov 26, 2026 at 12:13:57PM +0100, Andrea Righi wrote:
> @@ -11200,6 +11213,58 @@ struct sched_change_ctx *sched_change_begin(struct task_struct *p, unsigned int
> return ctx;
> }
>
> +/*
> + * Block a mutex-blocked task retained on the rq for proxy execution, because
> + * the class it is switching to does not accept blocked tasks.
> + *
> + * sched_change_begin() already dequeued @p from its old class and put it if
> + * it was the donor, so finish the job a sleeping dequeue would have done
> + * without going through a class again.
> + *
> + * The caller holds p->pi_lock, so @p cannot wake and migrate once
> + * __block_task() clears p->on_rq.
> + */
> +static void sched_change_block_task(struct rq *rq, struct sched_change_ctx *ctx)
> +{
> + struct task_struct *p = ctx->p;
> + unsigned long state = READ_ONCE(p->__state);
> +
> + lockdep_assert_held(&p->pi_lock);
> +
> + if (WARN_ON_ONCE(state == TASK_RUNNING))
> + return;
> +
> + /*
> + * Hand the donor role back to the execution context before clearing
> + * p->on_rq. This is proxy_reset_donor() without put_prev_task(), which
> + * sched_change_begin() already did, and without zapping the balance
> + * callbacks: nothing redoes them here, and they include the pull that
> + * switched_from_rt() or switched_from_dl() may have queued.
> + *
> + * If @p is rq->curr, __schedule() retained it and dropped the rq lock
> + * while picking. Block it like any prev that blocks in __schedule():
> + * keep it set, and let the pending pick put it.
> + */
> + if (ctx->running && rq->curr != p) {
> + struct task_struct *curr = rq->curr;
> +
> + __put_prev_set_next_dl_server(rq, p, curr);
> + curr->sched_class->set_next_task(rq, curr, SNT_PICK);
> + proxy_set_curr_donor(rq);
> + ctx->running = false;
> + }
> +
> + p->sched_contributes_to_load = task_state_contributes_to_load(state);
> +
> + /* The DEQUEUE_SAVE in sched_change_begin() skipped these. */
> + sched_info_dequeue(rq, p);
> + psi_dequeue(p, DEQUEUE_SLEEP);
Should we assert DEQUEUE_SAVE was set? I mean, it should be, but afaict
nothing screams if someone forgets? And with these changes on, it will
go a bit funny.
> + __block_task(rq, p);
> +
> + ctx->queued = false;
> +}
Other than that, this looks good. Let me go read the next patches.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-26 16:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 11:13 [PATCHSET sched_ext/for-7.5] sched/proxy: Handle retained donors on scheduling class transitions Andrea Righi
2026-11-26 11:13 ` [PATCH 1/4] sched: Let switching_to() decide whether to keep a retained proxy donor Andrea Righi
2026-11-26 16:01 ` Peter Zijlstra
2026-11-26 11:13 ` [PATCH 2/4] sched_ext: Make SCX_OPS_ENQ_BLOCKED a hierarchy-wide setting Andrea Righi
2026-11-26 11:13 ` [PATCH 3/4] sched: Remove sched_proxy_block_task() Andrea Righi
2026-11-26 11:14 ` [PATCH 4/4] selftests/sched_ext: Check that blocked donors are never enqueued unadmitted Andrea Righi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox