From: Peter Zijlstra <peterz@infradead.org>
To: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org,
Luca Abeni <luca.abeni@santannapisa.it>,
Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>,
Thomas Gleixner <tglx@linutronix.de>,
Joel Fernandes <joel@joelfernandes.org>,
Vineeth Pillai <vineeth@bitbyteword.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Phil Auld <pauld@redhat.com>
Subject: Re: [PATCH v4 6/7] sched/deadline: Deferrable dl server
Date: Tue, 5 Sep 2023 15:42:03 +0200 [thread overview]
Message-ID: <20230905134203.GA20703@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <754dab7f30695ca10a41613068bb63db3bfea003.1693510979.git.bristot@kernel.org>
On Thu, Aug 31, 2023 at 10:28:57PM +0200, Daniel Bristot de Oliveira wrote:
> +void dl_server_start(struct sched_dl_entity *dl_se, int defer)
> {
> + if (dl_se->server_state != DL_SERVER_STOPPED) {
> + WARN_ON_ONCE(!(on_dl_rq(dl_se) || dl_se->dl_throttled));
> + return;
> + }
> +
> + if (defer) {
> + /*
> + * Postpone the replenishment to the (next period - the execution time)
> + *
> + * With this in place, we have two cases:
> + *
> + * On the absence of DL tasks:
> + * The server will start at the replenishment time, getting
> + * its runtime before now + period. This is the expected
> + * throttling behavior.
> + *
> + * In the presense of DL tasks:
> + * The server will be replenished, and then it will be
> + * schedule according to EDF, not breaking SCHED_DEADLINE.
> + *
> + * In the first cycle the server will be postponed at most
> + * at period + period - runtime at most. But then the
> + * server will receive its runtime/period.
> + *
> + * The server will, however, run on top of any RT task, which
> + * is the expected throttling behavior.
> + */
> + dl_se->deadline = rq_clock(dl_se->rq) + dl_se->dl_period - dl_se->dl_runtime;
I was confused by this, but this is an instance of
replenish_dl_new_period(), where we explicitly do not preserve the
period.
> + /* Zero the runtime */
> + dl_se->runtime = 0;
> + /* throttle the server */
> + dl_se->dl_throttled = 1;
These comments are both obvious and placed so as to make everything
unreadable :/
> +
> + dl_se->server_state = DL_SERVER_DEFER;
> + start_dl_timer(dl_se);
> + return;
> + }
> +
> if (!dl_server(dl_se)) {
> dl_se->dl_server = 1;
> setup_new_dl_entity(dl_se);
> }
> +
> + dl_se->server_state = DL_SERVER_RUNNING;
> enqueue_dl_entity(dl_se, ENQUEUE_WAKEUP);
> }
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 580e6764a68b..b9d0f08dc8ca 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6499,9 +6499,6 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
> */
> util_est_enqueue(&rq->cfs, p);
>
> - if (!rq->cfs.h_nr_running)
> - dl_server_start(&rq->fair_server);
> -
> /*
> * If in_iowait is set, the code below may not trigger any cpufreq
> * utilization updates, so do it here explicitly with the IOWAIT flag
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index e23cc67c9467..7595110a5a3e 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1537,6 +1537,9 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags)
>
> if (!task_current(rq, p) && p->nr_cpus_allowed > 1)
> enqueue_pushable_task(rq, p);
> +
> + if (sched_fair_server_needed(rq))
> + dl_server_start(&rq->fair_server, rq->fair_server_defer);
> }
>
> static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int flags)
> @@ -1547,6 +1550,9 @@ static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int flags)
> dequeue_rt_entity(rt_se, flags);
>
> dequeue_pushable_task(rq, p);
> +
> + if (!sched_fair_server_needed(rq))
> + dl_server_stop(&rq->fair_server);
> }
>
> /*
I'm thinking this is wrong -- ISTR there definite benefits to explicit
slack time scheduling, meaning the server should also run while DL tasks
are on. Additionally, running the server when there are only fair tasks
is mostly harmless, right? So why this change?
One of the benefits was -- IIRC, that we no longer need to subtract some
random margin from the reservation limit, but there were more I think.
next prev parent reply other threads:[~2023-09-05 16:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 20:28 [PATCH v4 0/7] SCHED_DEADLINE server infrastructure Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 1/7] sched: Unify runtime accounting across classes Daniel Bristot de Oliveira
2023-09-15 21:41 ` Steven Rostedt
2023-08-31 20:28 ` [PATCH v4 2/7] sched/deadline: Collect sched_dl_entity initialization Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 3/7] sched/deadline: Move bandwidth accounting into {en,de}queue_dl_entity Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 4/7] sched/deadline: Introduce deadline servers Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 5/7] sched/fair: Add trivial fair server Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 6/7] sched/deadline: Deferrable dl server Daniel Bristot de Oliveira
2023-09-05 13:42 ` Peter Zijlstra [this message]
2023-09-05 15:24 ` Daniel Bristot de Oliveira
2023-09-06 8:29 ` Peter Zijlstra
2023-09-06 14:58 ` Daniel Bristot de Oliveira
2023-09-06 20:04 ` Peter Zijlstra
2023-09-06 20:08 ` Peter Zijlstra
2023-09-08 14:14 ` Daniel Bristot de Oliveira
2023-09-08 13:59 ` Daniel Bristot de Oliveira
2023-09-07 8:07 ` Peter Zijlstra
2023-09-08 15:28 ` Daniel Bristot de Oliveira
2023-09-08 16:11 ` Peter Zijlstra
2023-08-31 20:28 ` [PATCH v4 7/7] sched/fair: Fair server interface Daniel Bristot de Oliveira
2023-09-01 2:01 ` kernel test robot
2023-09-05 13:55 ` Peter Zijlstra
2023-09-05 16:17 ` Daniel Bristot de Oliveira
2023-09-06 7:25 ` Peter Zijlstra
2023-09-06 8:25 ` Peter Zijlstra
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=20230905134203.GA20703@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bristot@kernel.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=joel@joelfernandes.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=pauld@redhat.com \
--cc=rostedt@goodmis.org \
--cc=skhan@linuxfoundation.org \
--cc=tglx@linutronix.de \
--cc=tommaso.cucinotta@santannapisa.it \
--cc=vincent.guittot@linaro.org \
--cc=vineeth@bitbyteword.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
Powered by JetHome