From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Vincent Guittot <vincent.guittot@linaro.org>, <mingo@redhat.com>,
<peterz@infradead.org>, <juri.lelli@redhat.com>,
<dietmar.eggemann@arm.com>, <rostedt@goodmis.org>,
<bsegall@google.com>, <mgorman@suse.de>, <vschneid@redhat.com>,
<linux-kernel@vger.kernel.org>, <qyousef@layalina.io>
Subject: Re: [PATCH] sched/eevdf: Delayed dequeue task can't preempt
Date: Thu, 2 Jul 2026 10:26:08 +0530 [thread overview]
Message-ID: <8d2a006c-4157-40af-b33f-fb45f708555d@amd.com> (raw)
In-Reply-To: <20260701164920.1571352-1-vincent.guittot@linaro.org>
Hello Vincent,
On 7/1/2026 10:19 PM, Vincent Guittot wrote:
> Load balancing can migrate delayed dequeue tasks to even the load between
> CPUs.
>
> sched_balance_rq()
> -> detach_task()
> -> deactivate_task(DEQUEUE_NOCLOCK)
> -> set_task_cpu(dst_cpu)
>
> -> attach_task()
> -> activate_task(ENQUEUE_NOCLOCK)
> -> wakeup_preempt()
>
> A delayed task with shorter slice can be dequeued during pick_next_entity()
> but then jump to preempt because eligible.
>
> Always jump to update for delayed dequeue task even with shorter slice.
>
> Fixes: ba0d3bf5f97b ("sched/eevdf: Cancel slice protection if short slice task is eligible")
> Reported-by: K Prateek Nayak <kprateek.nayak@amd.com>
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Thank you for fixing this! Feel free to include:
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
> ---
> kernel/sched/fair.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index fc6cd55f9d22..df8c9c2c7918 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9948,6 +9948,13 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
> if (unlikely(!normal_policy(p->policy)))
> goto update;
>
> + /*
> + * Do not preempt for tasks that are sched_delayed as it would violate
> + * EEVDF to forcibly queue an ineligible task.
> + */
> + if (pse->sched_delayed)
> + goto update;
> +
Small question: Are we updating the protect slice just to maintain the
lag bounds with delayed entities?
Otherwise, it might be okay to return early here and keep the current
running for a bit longer and wait until the delayed entity gets a wakeup
which does a wakeup_preempt().
/me goes and checks
My hackbench run says:
Test: vanilla early_return
1-groups: 4.75 (0.00 pct) 4.46 ( 6.10 pct)
2-groups: 4.52 (0.00 pct) 4.57 (-1.10 pct)
4-groups: 4.67 (0.00 pct) 4.73 (-1.28 pct)
8-groups: 7.09 (0.00 pct) 6.85 ( 3.38 pct)
16-groups: 12.07 (0.00 pct) 12.03 ( 0.33 pct)
but there is enough variance in the improved runs that it could all be
noise so your patch should be good as is.
--
Thanks and Regards,
Prateek
next prev parent reply other threads:[~2026-07-02 4:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 16:49 [PATCH] sched/eevdf: Delayed dequeue task can't preempt Vincent Guittot
2026-07-02 4:56 ` K Prateek Nayak [this message]
2026-07-02 7:51 ` Vincent Guittot
2026-07-02 7:43 ` Peter Zijlstra
2026-07-02 7:53 ` Vincent Guittot
2026-07-02 9:01 ` Peter Zijlstra
2026-07-02 9:07 ` Vincent Guittot
2026-07-02 7:47 ` [tip: sched/core] " tip-bot2 for Vincent Guittot
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=8d2a006c-4157-40af-b33f-fb45f708555d@amd.com \
--to=kprateek.nayak@amd.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=qyousef@layalina.io \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.