From: Peter Zijlstra <peterz@infradead.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
kprateek.nayak@amd.com, linux-kernel@vger.kernel.org,
qyousef@layalina.io
Subject: Re: [PATCH 3/6 v3] sched/eevdf: Update slice protection even when resched is already set
Date: Fri, 26 Jun 2026 09:46:05 +0200 [thread overview]
Message-ID: <20260626074605.GB2568396@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260626072128.GI1181229@noisy.programming.kicks-ass.net>
On Fri, Jun 26, 2026 at 09:21:28AM +0200, Peter Zijlstra wrote:
> On Wed, Jun 24, 2026 at 05:12:26PM +0200, Vincent Guittot wrote:
> > Even if resched is already set, we might want to update or even cancel
> > the slice protection and ensure that the newly waking task will be the
> > next one to run.
> >
> > Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> > Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
> > ---
> > kernel/sched/fair.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 8639086e5d9e..854f3a9f1d80 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -9804,7 +9804,7 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
> > * prevents us from potentially nominating it as a false LAST_BUDDY
> > * below.
> > */
> > - if (test_tsk_need_resched(rq->curr))
> > + if (!sched_feat(PREEMPT_SHORT) && test_tsk_need_resched(rq->curr))
> > return;
> >
> > if (!sched_feat(WAKEUP_PREEMPTION))
>
> This one is leading to boot splats for me -- let me try and figure out
> why.
Bah!
Subject: sched/core: Fix inter-class wakeup_preempt()
From: Peter Zijlstra <peterz@infradead.org>
Date: Fri Jun 26 09:36:52 CEST 2026
The way wakeup_preempt() works since commit 704069649b5b ("sched/core: Rework
sched_class::wakeup_preempt() and rq_modified_*()") is that it will call
rq->next_class->wakeup_preempt(rq, p) when p is of an equal or higher class,
and raise ->next_class when higher.
This means that:
running idle task
wakeup fair-A
(next_class == idle)
if (sched_class_above(fair, idle)) {
wakeup_preempt_idle(fair-A);
resched_curr(rq);
next_class = fair;
}
wakeup fair-B
(next_class == fair)
if (fair == fair)
wakeup_preempt_fair(fair-B);
(but current is idle)
All wakeup_preempt_$class() methods, except for wakeup_preempt_scx() (for whoem
this was build) ignore cross-class wakeups by testing if @p is of the right
class, but per the above case, it also should check current.
This is mostly harmless in the current form, but will lead to trouble with
later patches.
Fixes: 704069649b5b ("sched/core: Rework sched_class::wakeup_preempt() and rq_modified_*()")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/sched/deadline.c | 6 ++++--
kernel/sched/fair.c | 3 ++-
kernel/sched/rt.c | 3 ++-
3 files changed, 8 insertions(+), 4 deletions(-)
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2733,15 +2733,17 @@ static int balance_dl(struct rq *rq, str
*/
static void wakeup_preempt_dl(struct rq *rq, struct task_struct *p, int flags)
{
+ struct task_struct *donor = rq->donor;
/*
* Can only get preempted by stop-class, and those should be
* few and short lived, doesn't really make sense to push
* anything away for that.
*/
- if (p->sched_class != &dl_sched_class)
+ if (p->sched_class != &dl_sched_class ||
+ donor->sched_class != &dl_sched_class)
return;
- if (dl_entity_preempt(&p->dl, &rq->donor->dl)) {
+ if (dl_entity_preempt(&p->dl, &donor->dl)) {
resched_curr(rq);
return;
}
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9778,7 +9778,8 @@ static void wakeup_preempt_fair(struct r
/*
* XXX Getting preempted by higher class, try and find idle CPU?
*/
- if (p->sched_class != &fair_sched_class)
+ if (p->sched_class != &fair_sched_class ||
+ donor->sched_class != &fair_sched_class)
return;
if (unlikely(se == pse))
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1629,7 +1629,8 @@ static void wakeup_preempt_rt(struct rq
/*
* XXX If we're preempted by DL, queue a push?
*/
- if (p->sched_class != &rt_sched_class)
+ if (p->sched_class != &rt_sched_class ||
+ donor->sched_class != &rt_sched_class)
return;
if (p->prio < donor->prio) {
next prev parent reply other threads:[~2026-06-26 7:46 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 15:12 [PATCH 0/6 v3] sched/eevdf: Improve scheduling latency of short slice task Vincent Guittot
2026-06-24 15:12 ` [PATCH 1/6 v3] sched/fair: Set next buddy for preempt short Vincent Guittot
2026-06-25 6:24 ` K Prateek Nayak
2026-06-25 12:40 ` Vincent Guittot
2026-06-25 12:43 ` Peter Zijlstra
2026-06-26 6:54 ` Peter Zijlstra
2026-06-26 7:02 ` Vincent Guittot
2026-06-26 8:08 ` Peter Zijlstra
2026-06-26 8:55 ` Vincent Guittot
2026-06-30 9:03 ` [tip: sched/core] " tip-bot2 for Vincent Guittot
2026-06-24 15:12 ` [PATCH 2/6 v3] sched/eevdf: Take into account current's lag when updating slice protection Vincent Guittot
2026-06-30 9:03 ` [tip: sched/core] " tip-bot2 for Vincent Guittot
2026-06-24 15:12 ` [PATCH 3/6 v3] sched/eevdf: Update slice protection even when resched is already set Vincent Guittot
2026-06-26 7:21 ` Peter Zijlstra
2026-06-26 7:46 ` Peter Zijlstra [this message]
2026-06-30 9:03 ` [tip: sched/core] sched/core: Fix inter-class wakeup_preempt() tip-bot2 for Peter Zijlstra
2026-06-30 9:03 ` [tip: sched/core] sched/eevdf: Update slice protection even when resched is already set tip-bot2 for Vincent Guittot
2026-06-24 15:12 ` [PATCH 4/6 v3] sched/eevdf: Cancel slice protection if short slice task is eligible Vincent Guittot
2026-06-25 6:00 ` K Prateek Nayak
2026-06-25 12:40 ` Vincent Guittot
2026-06-26 5:51 ` Shubhang Kaushik
2026-06-26 7:39 ` Vincent Guittot
2026-06-30 9:03 ` [tip: sched/core] " tip-bot2 for Vincent Guittot
2026-06-24 15:12 ` [PATCH 5/6 v3] sched/eevdf: Always update slice protection Vincent Guittot
2026-06-30 9:03 ` [tip: sched/core] " tip-bot2 for Vincent Guittot
2026-06-24 15:12 ` [PATCH 6/6 v3] sched/eevdf: Speedup short slice task scheduling Vincent Guittot
2026-06-25 7:37 ` K Prateek Nayak
2026-06-25 8:37 ` Peter Zijlstra
2026-06-25 10:09 ` Peter Zijlstra
2026-06-25 12:57 ` Vincent Guittot
2026-06-25 12:59 ` Vincent Guittot
2026-06-25 22:28 ` Peter Zijlstra
2026-06-26 3:57 ` K Prateek Nayak
2026-06-26 6:41 ` Peter Zijlstra
2026-06-26 7:05 ` Vincent Guittot
2026-06-26 7:18 ` Peter Zijlstra
2026-06-26 7:54 ` Peter Zijlstra
2026-06-26 8:55 ` Vincent Guittot
2026-06-26 13:55 ` Vincent Guittot
2026-06-29 14:25 ` Vincent Guittot
2026-06-25 14:55 ` Vincent Guittot
2026-06-25 12:51 ` Vincent Guittot
2026-06-25 8:33 ` Peter Zijlstra
2026-06-30 9:03 ` [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=20260626074605.GB2568396@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®