From: sashiko-bot@kernel.org
To: "Vincent Guittot" <vincent.guittot@linaro.org>,
sched-ext@lists.linux.dev
Subject: Re: [PATCH 20/20 v3] sched/fair: Fix tasks stacking on same idle CPU
Date: Fri, 06 Nov 2026 16:53:57 +0000 [thread overview]
Message-ID: <sashiko-outbox-201870@kernel.org> (raw)
In-Reply-To: <20261106151947.3991524-21-vincent.guittot@linaro.org>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] sched/fair: throttled task added to pushable_tasks in
wakeup_preempt_fair()
- [High] sched/fair: missing throttled check in
__check_pushable_fair_task()
- [High] sched/fair: active proxy task and blocked donor pushed via
wakeup_preempt_fair()
--
commit b3ffe0a34e21054c91665b78a86f2ced2b7f31de
Author: Vincent Guittot <vincent.guittot@linaro.org>
sched/fair: Fix tasks stacking on same idle CPU
This commit invokes wakeup_preempt() on the higher scheduling class during
cross-class wakeups and adds eligible fair tasks to the pushable list when
waking on a runqueue whose donor belongs to a lower scheduling class.
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index a1a3aa45ecf68..ef4cbcca24372 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2311,6 +2311,7 @@ void wakeup_preempt(struct rq *rq, struct task_struct *p, int flags)
> rq->next_class->wakeup_preempt(rq, p, flags);
> resched_curr(rq);
> rq->next_class = p->sched_class;
> + rq->next_class->wakeup_preempt(rq, p, flags);
> }
>
> /*
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index da9c4416f1b5c..2626264554978 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10649,10 +10649,22 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
> /*
> * XXX Getting preempted by higher class, try and find idle CPU?
> */
> - if (p->sched_class != &fair_sched_class ||
> - donor->sched_class != &fair_sched_class)
> + if (p->sched_class != &fair_sched_class)
> return;
>
> + if (donor->sched_class != &fair_sched_class) {
> + /*
> + * When rq is idle, several tasks can select this rq at wakeup
> + * without knowing others did the same. Give another chance to
> + * select another rq if not picked.
> + */
> + if (sched_class_above(&fair_sched_class, donor->sched_class) &&
> + entity_eligible(cfs_rq, pse))
> + fair_add_pushable_short(rq, p);
> +
> + return;
> + }
> +
> if (unlikely(se == pse))
> return;
>
[Severity: High]
Can this regression add a throttled task to rq->cfs.pushable_tasks because
the new donor->sched_class != &fair_sched_class block runs before the
task_is_throttled(p) check further down in wakeup_preempt_fair()?
When move_queued_task(), attach_task(), sched_move_task(), or
prio_changed_fair() enqueues a throttled task onto an idle runqueue via
enqueue_throttled_task() and then calls wakeup_preempt(), p->on_rq remains
TASK_ON_RQ_QUEUED while p->se.on_rq is 0. fair_add_pushable_short() passes
__check_pushable_fair_task() and links p into rq->cfs.pushable_tasks. If p
is later dequeued while still throttled, dequeue_task_fair() returns early
via dequeue_throttled_task() without calling fair_remove_pushable_task(),
leaving p->pushable_tasks dangling on the old runqueue across migration or
task exit, or allowing fair_push_task() to migrate and prematurely
unthrottle p on another CPU.
[Severity: High]
Along the same lines, should __check_pushable_fair_task() added in commit
"sched/fair: Add push task mechanism for fair" also reject throttled tasks
(or tasks with !p->se.on_rq)?
kernel/sched/fair.c:__check_pushable_fair_task() {
if (!task_on_rq_queued(p))
return false;
if (p->se.sched_delayed)
return false;
...
}
When throttle_cfs_rq_work() throttles a running task prev, it places prev
on cfs_rq->throttled_limbo_list with prev->throttled = true and
prev->se.on_rq = 0 while leaving prev->on_rq as TASK_ON_RQ_QUEUED. Both
wakeup_preempt_fair() -> fair_add_pushable_short() and put_prev_task_fair()
-> fair_add_pushable_prev() reach __check_pushable_fair_task() and add the
throttled task to rq->cfs.pushable_tasks, leading to the same premature
unthrottling in fair_push_task() or plist corruption when
dequeue_throttled_task() bypasses fair_remove_pushable_task().
[Severity: High]
Under CONFIG_SCHED_PROXY_EXEC, can this regression queue an actively
running proxy task or a mutex-blocked donor onto rq->cfs.pushable_tasks?
When a fair donor d is blocked on a mutex whose fair owner p was sleeping,
proxy_resched_idle() sets rq->donor to rq->idle. When p wakes on that CPU,
wakeup_preempt_fair() sees donor->sched_class == &idle_sched_class and adds
p to rq->cfs.pushable_tasks via fair_add_pushable_short(). In __schedule(),
pick_next_task_fair() picks the blocked donor d, so set_next_task_fair()
removes d (not p) from pushable_tasks and queues fair_push_tasks(), after
which find_proxy_task() selects p as rq->curr. When fair_push_task() runs,
pick_next_pushable_fair_task() triggers WARN_ON_ONCE(task_current(rq, p))
and still returns p to fair_push_task(), which deactivates and migrates p
to another CPU while p is actively executing on rq.
Similarly, when proxy_migrate_task() attaches a blocked donor
(task_is_blocked(p)) to a runqueue whose donor is idle or ext_sched_class,
wakeup_preempt_fair() adds the blocked donor to pushable_tasks, allowing
fair_push_task() to migrate it away from its mutex owner's CPU and
overwrite p->wake_cpu.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261106151947.3991524-2-vincent.guittot@linaro.org?part=20
prev parent reply other threads:[~2026-11-06 16:53 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 15:19 [PATCH 00/18 v3] Improving latency of short slice tasks Vincent Guittot
2026-11-06 15:19 ` [PATCH 01/20 v3] sched/eevdf: Decay positive lag of sleeping entities Vincent Guittot
2026-11-06 15:43 ` sashiko-bot
2026-11-06 15:19 ` [PATCH 02/20 v3] sched/eevdf: Reset lag at wakeup when prev CPU has been idle Vincent Guittot
2026-11-06 16:22 ` Kayra Cizmeci
2026-11-09 15:27 ` Vincent Guittot
2026-11-09 15:45 ` Peter Zijlstra
2026-11-09 16:27 ` Vincent Guittot
2026-11-11 9:03 ` Peter Zijlstra
2026-11-12 7:02 ` Vincent Guittot
2026-11-11 10:04 ` K Prateek Nayak
2026-11-12 7:33 ` Vincent Guittot
2026-11-06 15:19 ` [PATCH 03/20 v3] sched/eevdf: Reset lag at wakeup when migrating and prev " Vincent Guittot
2026-11-06 18:05 ` Kayra Cizmeci
2026-11-06 15:19 ` [PATCH 04/20 v3] sched/eevdf: Reset lag when waking up on idle cpu Vincent Guittot
2026-11-06 18:39 ` Kayra Cizmeci
2026-11-06 15:19 ` [PATCH 05/20 v3] sched/eevdf: Add per cpu cached min_slice Vincent Guittot
2026-11-07 6:53 ` Kayra Cizmeci
2026-11-09 15:27 ` Vincent Guittot
2026-11-06 15:19 ` [PATCH 06/20 v3] sched/eevdf: Add min slice check when selecting CPU Vincent Guittot
2026-11-06 15:40 ` sashiko-bot
2026-11-07 8:57 ` Kayra Cizmeci
2026-11-09 13:55 ` Peter Zijlstra
2026-11-09 14:15 ` Kayra Cizmeci
2026-11-09 15:37 ` Vincent Guittot
2026-11-09 15:34 ` Vincent Guittot
2026-11-09 15:55 ` Vincent Guittot
2026-11-09 19:56 ` Kayra Cizmeci
2026-11-10 13:32 ` Vincent Guittot
2026-11-06 15:19 ` [PATCH 07/20 v3] sched/fair: Prepare select_task_rq_fair() to be called for new cases Vincent Guittot
2026-11-06 15:39 ` sashiko-bot
2026-11-06 15:19 ` [PATCH 08/20 v3] sched/fair: Add push task mechanism for fair Vincent Guittot
2026-11-06 16:15 ` sashiko-bot
2026-11-09 14:43 ` Peter Zijlstra
2026-11-09 16:07 ` Vincent Guittot
2026-11-11 8:59 ` Peter Zijlstra
2026-11-12 7:01 ` Vincent Guittot
2026-11-09 15:54 ` Peter Zijlstra
2026-11-09 16:14 ` Vincent Guittot
2026-11-11 9:01 ` Peter Zijlstra
2026-11-12 7:01 ` Vincent Guittot
2026-11-12 7:36 ` Vincent Guittot
2026-11-12 9:49 ` Peter Zijlstra
2026-11-12 11:29 ` Vincent Guittot
2026-11-12 12:19 ` Peter Zijlstra
2026-11-06 15:19 ` [PATCH 09/20 v3] sched/fair: Optimize " Vincent Guittot
2026-11-06 16:00 ` sashiko-bot
2026-11-06 15:19 ` [PATCH 10/20 v3] sched/core: Add rq flag to tick parameters Vincent Guittot
2026-11-06 15:19 ` [PATCH 11/20 v3] sched/fair: Add force push task mechanism for fair Vincent Guittot
2026-11-06 16:16 ` sashiko-bot
2026-11-06 15:19 ` [PATCH 12/20 v3] sched/fair: Support not wakeup case in select_idle_sibling Vincent Guittot
2026-11-06 15:51 ` sashiko-bot
2026-11-13 5:31 ` kernel test robot
2026-11-06 15:19 ` [PATCH 13/20] sched/eevdf: Try to push short slice task on a better CPU Vincent Guittot
2026-11-06 16:12 ` sashiko-bot
2026-11-06 15:19 ` [PATCH 14/20 v3] sched/eevdf: Push short slice task that are not picked Vincent Guittot
2026-11-06 16:14 ` sashiko-bot
2026-11-06 15:19 ` [PATCH 15/20 v3] sched/fair: Enable push task for preempt short Vincent Guittot
2026-11-06 16:27 ` sashiko-bot
2026-11-06 15:19 ` [PATCH 16/20 v3] energy model: Add a get previous state function Vincent Guittot
2026-11-10 19:55 ` Rafael J. Wysocki (Intel)
2026-11-06 15:19 ` [PATCH 17/20 v3] sched/fair: Rework feec() to use cost instead of spare capacity Vincent Guittot
2026-11-06 16:30 ` sashiko-bot
2026-11-06 15:19 ` [PATCH 18/20 v3] energy model: Remove unused em_cpu_energy() Vincent Guittot
2026-11-06 15:19 ` [PATCH 19/20 v3] sched/fair: Take into account slice in EAS Vincent Guittot
2026-11-06 16:26 ` sashiko-bot
2026-11-06 15:19 ` [PATCH 20/20 v3] sched/fair: Fix tasks stacking on same idle CPU Vincent Guittot
2026-11-06 16:53 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-201870@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox