Skip to contentSkip to conversation

sched: Switch rq->next_class on proxy_resched_idle()

PATCH Applied John Stultz 2 participants 2 messages May 14 – May 20 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Switch rq->next_class on proxy_resched_idle()

K Prateek noticed we weren't setting the rq->next_class in proxy_resched_idle(), when I was debugging an issue seen with CONFIG_SCHED_PROXY_EXEC and some of Peter's new patches, and suggested this fix.

So set rq->next_class when we temporarily switch the donor to idle, so we don't accidentally call wakeup_preempt_fair() with idle as the donor.

---
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Juri Lelli <[email protected]>
Cc: Vincent Guittot <[email protected]>
Cc: Dietmar Eggemann <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Ben Segall <[email protected]>
Cc: Valentin Schneider <[email protected]>
Cc: K Prateek Nayak <[email protected]>
Cc: [email protected]

---
 kernel/sched/core.c | 1 +
 1 file changed, 1 insertion(+)
kernel/sched/core.c +1 -0
index b8871449d3c69..0ec04008ccd6b 100644
@@ -6645,6 +6645,7 @@ static inline void proxy_set_task_cpu(struct task_struct *p, int cpu)
 static inline struct task_struct *proxy_resched_idle(struct rq *rq)
 {
 	put_prev_set_next_task(rq, rq->donor, rq->idle);
+	rq->next_class = &idle_sched_class;
 	rq_set_donor(rq, rq->idle);
 	set_tsk_need_resched(rq->idle);
 	return rq->idle;
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
merge bot Applied
#1 lore raw
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     04f80f8b12a02fa2e0827c8f37eb357adca8ce44
Gitweb:        https://git.kernel.org/tip/04f80f8b12a02fa2e0827c8f37eb357adca8ce44
Author:        John Stultz <[email protected]>
AuthorDate:    Thu, 14 May 2026 23:47:17 
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 19 May 2026 12:17:39 +02:00

sched: Switch rq->next_class on proxy_resched_idle()

K Prateek noticed we weren't setting the rq->next_class in proxy_resched_idle(), when I was debugging an issue seen with CONFIG_SCHED_PROXY_EXEC and some of Peter's new patches, and suggested this fix.

So set rq->next_class when we temporarily switch the donor to idle, so we don't accidentally call wakeup_preempt_fair() with idle as the donor.

---
 kernel/sched/core.c | 1 +
 1 file changed, 1 insertion(+)
kernel/sched/core.c +1 -0
index 3ae5f19..77f4ebe 100644
@@ -6653,6 +6653,7 @@ static inline void proxy_set_task_cpu(struct task_struct *p, int cpu)
 static inline struct task_struct *proxy_resched_idle(struct rq *rq)
 {
 	put_prev_set_next_task(rq, rq->donor, rq->idle);
+	rq->next_class = &idle_sched_class;
 	rq_set_donor(rq, rq->idle);
 	set_tsk_need_resched(rq->idle);
 	return rq->idle;