All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Fernand Sieber <sieberf@amazon.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Shuah Khan <shuah@kernel.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Daniel Bristot de Oliveira <bristot@kernel.org>,
	Joel Fernandes <joelagnelf@nvidia.com>,
	Josh Don <joshdon@google.com>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	nh-open-source@amazon.com, Fahad Mubeen <fmubeen@amazon.de>,
	David Woodhouse <dwmw@amazon.co.uk>,
	Misha Karataiev <karataev@amazon.com>,
	Hendrik Borghorst <hborghor@amazon.de>,
	Ibrahim Elshahed <lshahed@amazon.de>
Subject: Re: [PATCH 2/5] sched/core: Keep a sibling's DL server link in the core-wide pick
Date: Wed, 18 Nov 2026 14:58:12 +0100	[thread overview]
Message-ID: <20261118135812.GI1922751@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261118135052.GX1779021@noisy.programming.kicks-ass.net>

On Wed, Nov 18, 2026 at 02:50:52PM +0100, Peter Zijlstra wrote:
> On Thu, Nov 12, 2026 at 06:15:45PM +0200, Fernand Sieber wrote:
> > The core-wide selection records in rq_i->core_dl_server the DL server
> > each sibling's pick came through, then clears it for every sibling in
> > the cookie matching loop, including when the pick is kept. The sibling
> > takes the fast path, which sets rq->dl_server from rq->core_dl_server,
> > and runs the task its server picked with p->dl_server NULL. Only the
> > selecting CPU keeps the link, as its pick goes through rq->dl_server.
> > 
> > A running task is ranked for core scheduling by p->dl_server. While
> > such a task runs on a sibling, each following core-wide selection
> > ranks it as a plain fair or ext task rather than by its server's
> > deadline, so a higher class task on another sibling takes the core
> > back before the server's runtime is used. The RV nomiss monitor, which
> > follows the server through next->dl_server at sched_switch, does not
> > see the server run either.
> > 
> > Keep the server that pick_task() left in rq_i->dl_server. With the
> > previous patch it is NULL when the class pick was replaced. Drop the
> > assignment in the first loop, which the matching loop always
> > overwrites.
> > 
> > Fixes: bd9bbc96e835 ("sched: Rework dl_server")
> > Signed-off-by: Fernand Sieber <sieberf@amazon.com>
> > ---
> >  kernel/sched/core.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index f7ac13186ee59..61d4e6e990bba 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -6431,7 +6431,6 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
> >  		}
> >  
> >  		rq_i->core_pick = p;
> > -		rq_i->core_dl_server = rq_i->dl_server;
> >  
> >  		if (!max || prio_less(max, p, fi_before))
> >  			max = p;
> > @@ -6462,7 +6461,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
> >  		}
> >  
> >  		rq_i->core_pick = p;
> > -		rq_i->core_dl_server = NULL;
> > +		rq_i->core_dl_server = rq_i->dl_server;
> >  
> >  		if (p == rq_i->idle) {
> >  			if (rq_i->nr_running) {
> 
> Isn't this broken in the face of a rq->lock drop through pick_task() ?
> 
> Consider this does:
> 
>   SMT0: pick_task()
>   SMT1: pick_task()
>           drop rq->lock
> 	    newidle
> 
>   SMT0: rq_0->core_dl_server = rq_0->dl_server;
> 
> 
> I am reworking all of that somewhere, but delaying saving rq->dl_server
> like this feels fragile.
> 
> Can't we fold the first two patches into something like so?
> 
> ---
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 175b52a7ea79..68b980ddf88f 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6453,10 +6453,16 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
>  				p = sched_core_find(rq_i, cookie);
>  			if (!p)
>  				p = idle_sched_class.pick_task(rq_i, rf);
> +
> +			/*
> +			 * Neither a core tree pick nor idle comes through a
> +			 * DL server; drop the one the replaced pick left.
> +			 */
> +			rq_i->dl_server = NULL;
>  		}
>  
>  		rq_i->core_pick = p;
> -		rq_i->core_dl_server = NULL;
> +		rq_i->core_dl_server = rq_i->dl_server;

No that isn't quite right either, perhaps just make it:

			rq_i->core_dl_server = rq_i->dl_server = NULL;


  reply	other threads:[~2026-11-18 13:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 16:15 [PATCH 0/5] sched: Fix DL server starvation under core scheduling Fernand Sieber
2026-11-12 16:15 ` [PATCH 1/5] sched/core: Clear stale rq->dl_server when core-sched replaces a pick Fernand Sieber
2026-11-22 22:49   ` [tip: sched/urgent] sched/deadline: " tip-bot2 for Fernand Sieber
2026-11-23  9:44   ` tip-bot2 for Fernand Sieber
2026-11-12 16:15 ` [PATCH 2/5] sched/core: Keep a sibling's DL server link in the core-wide pick Fernand Sieber
2026-11-18 13:50   ` Peter Zijlstra
2026-11-18 13:58     ` Peter Zijlstra [this message]
2026-11-12 16:15 ` [PATCH 3/5] sched/core: Rank DL server picks as deadline " Fernand Sieber
2026-11-18 13:52   ` Peter Zijlstra
2026-11-23  9:55   ` [tip: sched/core] " tip-bot2 for Fernand Sieber
2026-11-29 14:00   ` [tip: sched/urgent] " tip-bot2 for Fernand Sieber
2026-11-12 16:15 ` [PATCH 4/5] sched/deadline: Don't charge core-sched forced idle to the DL servers Fernand Sieber
2026-11-22 22:49   ` [tip: sched/urgent] " tip-bot2 for Fernand Sieber
2026-11-23  9:44   ` tip-bot2 for Fernand Sieber
2026-11-24  8:07   ` [PATCH 4/5] " Karl Mehltretter
2026-11-24  9:40     ` [PATCH 0/2] sched/deadline: Fix forced idle charged when a sibling ends it Fernand Sieber
2026-11-24  9:40       ` [PATCH 1/2] sched/deadline: Keep forced idle uncharged " Fernand Sieber
2026-11-24  9:40       ` [PATCH 2/2] selftests/sched: Let the FIFO task block in cs_dl_server_test Fernand Sieber
2026-11-24  9:46     ` [PATCH 4/5] sched/deadline: Don't charge core-sched forced idle to the DL servers Fernand Sieber
2026-11-12 16:15 ` [PATCH 5/5] selftests/sched: Add a core-sched forced-idle DL server test Fernand Sieber
2026-11-22 22:49   ` [tip: sched/urgent] " tip-bot2 for Fernand Sieber
2026-11-23 15:37     ` Fernand Sieber
2026-11-29 14:02       ` Ingo Molnar
2026-11-30 12:09         ` Peter Zijlstra
2026-11-23  9:44   ` tip-bot2 for Fernand Sieber

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=20261118135812.GI1922751@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bristot@kernel.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=dwmw@amazon.co.uk \
    --cc=fmubeen@amazon.de \
    --cc=hborghor@amazon.de \
    --cc=joelagnelf@nvidia.com \
    --cc=joshdon@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=karataev@amazon.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lshahed@amazon.de \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=nh-open-source@amazon.com \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=sieberf@amazon.com \
    --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.