Sched_ext development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vincent Guittot" <vincent.guittot@linaro.org>,
	sched-ext@lists.linux.dev
Subject: Re: [PATCH 13/20] sched/eevdf: Try to push short slice task on a better CPU
Date: Fri, 06 Nov 2026 16:12:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-201777@kernel.org> (raw)
In-Reply-To: <20261106151947.3991524-14-vincent.guittot@linaro.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] sched/fair: fair_check_pushable_task() pushes !se.on_rq and
  idle-next tasks
- [High] sched/fair: fair_check_pushable_task() pushes proxy-exec owners
  and donors
--

commit 016c5e088e8b372064ad1e24d8191243bb3c5d70
Author: Vincent Guittot <vincent.guittot@linaro.org>

sched/eevdf: Try to push short slice task on a better CPU

This commit extends fair_check_pushable_task() to mark a fair task as
pushable when preempted by another scheduling class or when it is an
eligible short-slice task.

> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 980eda9c935a8..3923587b66e0e 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10112,6 +10112,23 @@ static bool __check_pushable_fair_task(struct rq *rq, struct task_struct *p)
>  	return true;
>  }
>  
> +static bool check_pushable_short_task(struct rq *rq, struct task_struct *p)
> +{
> +	struct sched_entity *pse = &p->se;
> +	struct cfs_rq *cfs_rq = &rq->cfs;
> +
> +	if (cfs_rq->h_nr_runnable <= 1)
> +		return false;
> +
> +	if (!entity_eligible(cfs_rq, pse))
> +		return false;
> +
> +	if (pse->slice < cfs_rq_max_slice(cfs_rq))
> +		return true;
> +
> +	return false;
> +}
> +
>  static bool fair_check_pushable_task(struct rq *rq, struct task_struct *p, struct task_struct *next)
>  {
>  	if (!__check_pushable_fair_task(rq, p))
> @@ -10120,6 +10137,12 @@ static bool fair_check_pushable_task(struct rq *rq, struct task_struct *p, struc
>  	if (next == p)
>  		return false;
>  
> +	if (next && next->sched_class != p->sched_class)
> +		return true;
> +
> +	if (check_pushable_short_task(rq, p))
> +		return true;
> +
>  	return false;
>  }

[Severity: High]
Can fair_check_pushable_task() queue a task onto rq->cfs.pushable_tasks
when p->se.on_rq is 0 or when next is rq->idle?

In put_prev_task_fair(), fair_add_pushable_prev() runs even when se->on_rq
is 0, and __check_pushable_fair_task() only checks task_on_rq_queued(p) and
p->se.sched_delayed.  When throttle_cfs_rq_work() throttles a running task,
it calls dequeue_task_fair() (clearing p->se.on_rq) while leaving p->on_rq
as TASK_ON_RQ_QUEUED.  Because next->sched_class != p->sched_class also
matches idle_sched_class (instead of checking sched_class_above()),
switching to idle or another task queues the throttled task onto
rq->cfs.pushable_tasks.  fair_push_task() can then migrate it to an
unthrottled remote CPU where enqueue_throttled_task() clears p->throttled
and lets it escape CFS bandwidth enforcement, or dequeue_task_fair() can
take the early task_is_throttled() return and leave a dangling node in
pushable_tasks.

Similarly, under CONFIG_SCHED_PROXY_EXEC, proxy_needs_return() calls
dequeue_block_task() before proxy_reset_donor() -> put_prev_task_fair(),
re-adding p to pushable_tasks after dequeue_task_fair() has already run and
before __block_task() clears p->on_rq.

[Severity: High]
Under CONFIG_SCHED_PROXY_EXEC, can fair_check_pushable_task() cause
fair_push_task() to migrate a currently running mutex owner or a blocked
donor task?

If a running fair task p owns a mutex held across put_prev_set_next_task()
when a blocked waiter is picked as the next donor, put_prev_task_fair()
adds p to rq->cfs.pushable_tasks, and find_proxy_task() then selects p to
keep running as rq->curr without calling set_next_task_fair().  Because
pick_next_pushable_fair_task() only warns on task_current(rq, p) rather
than skipping task_on_cpu(rq, p), fair_push_task() deactivates and migrates
p to another CPU while it is actively executing on the local CPU.

In addition, __check_pushable_fair_task() does not check
task_is_blocked(p), so a mutex-blocked fair donor deselected in
put_prev_task_fair() can be pushed away from its mutex owner's CPU via
set_task_cpu(), clobbering p->wake_cpu.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106151947.3991524-2-vincent.guittot@linaro.org?part=13

  reply	other threads:[~2026-11-06 16:12 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 [this message]
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

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-201777@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