[tip: sched/core] sched/core: Don't steal a proxy-exec donor
From: tip-bot2 for Vasily Gorbik
Date: Wed Sep 02 2026 - 04:05:06 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 3dd95f077371f5def65a91c4bb13bd574a62bc3a
Gitweb: https://git.kernel.org/tip/3dd95f077371f5def65a91c4bb13bd574a62bc3a
Author: Vasily Gorbik <gor@xxxxxxxxxxxxx>
AuthorDate: Fri, 07 Aug 2026 03:52:08
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Wed, 02 Sep 2026 09:37:20 +02:00
sched/core: Don't steal a proxy-exec donor
try_steal_cookie() avoids stealing src->core_pick and src->curr before
moving a task with the same cookie via move_queued_task_locked().
With proxy-exec, src->donor is the current scheduling context and may
differ from src->curr. Stealing it migrates a task that the source rq
still treats as current, leaving src's scheduler state for that task
stale. For CFS this means cfs_rq->curr points at the stolen entity,
and the next pick on the source rq hits the WARN_ON_ONCE in
put_prev_entity().
Commit 7de9d4f94638 ("sched: Start blocked_on chain processing in
find_proxy_task()") tweaked the fair class logic so that the donor task
isn't migrated away while we're running the proxy. Do it similarly for
try_steal_cookie() and skip src->donor as well.
Fixes: 7de9d4f94638 ("sched: Start blocked_on chain processing in find_proxy_task()")
Signed-off-by: Vasily Gorbik <gor@xxxxxxxxxxxxx>
Signed-off-by: John Stultz <jstultz@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20260807035232.1881495-3-jstultz@xxxxxxxxxx
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7472450..7adbdcc 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6509,7 +6509,7 @@ static bool try_steal_cookie(int this, int that)
return false;
do {
- if (p == src->core_pick || p == src->curr)
+ if (p == src->core_pick || p == src->curr || p == src->donor)
goto next;
if (!is_cpu_allowed(p, this))