From: Daniel Bristot de Oliveira <bristot@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>,
Daniel Bristot de Oliveira <bristot@redhat.com>
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>,
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: Fri, 8 Sep 2023 17:28:46 +0200 [thread overview]
Message-ID: <658f807e-7f7a-e6d2-25e7-00eb2187af2a@kernel.org> (raw)
In-Reply-To: <20230907080729.GA16872@noisy.programming.kicks-ass.net>
On 9/7/23 10:07, Peter Zijlstra wrote:
> On Wed, Sep 06, 2023 at 04:58:11PM +0200, Daniel Bristot de Oliveira wrote:
>
>>> Yeah, it's a wee hack to move it to the zero-laxity point. I was
>>> considering if it makes sense to push that down and make it available
>>> for all DL tasks, but I'm not sure..
>>
>> It might be useful in the future, like when DL dominates all other schedulers, so
>> we can have a way to schedule a deferred work, like kworkers... :-) But it might be
>> too early for that..
>
> So... that scheme I was pushing where we unconditionally decrement
> fair_server.dl_runtime from update_curr_fair(), that relies on it being
> a proper zero-laxity scheduler, and doesn't work with the proposed defer
> hack.
>
> That is, it relies on dl_runtime > 0 during throttle, and you explicitly
> set it 0.
>
> Now, I've not looked at all this code in detail in a minute, but would
> not something like the below work?
>
> AFAICT the regular dl_task_timer() callback works to make it go, because
> replenish will see positive runtime (or not, when already consumed) and
> DTRT.
>
>
> Index: linux-2.6/include/linux/sched.h
> ===================================================================
> --- linux-2.6.orig/include/linux/sched.h
> +++ linux-2.6/include/linux/sched.h
> @@ -657,6 +657,7 @@ struct sched_dl_entity {
> unsigned int dl_non_contending : 1;
> unsigned int dl_overrun : 1;
> unsigned int dl_server : 1;
> + unsigned int dl_zerolax : 1;
>
> /*
> * Bandwidth enforcement timer. Each -deadline task has its
> Index: linux-2.6/kernel/sched/deadline.c
> ===================================================================
> --- linux-2.6.orig/kernel/sched/deadline.c
> +++ linux-2.6/kernel/sched/deadline.c
> @@ -895,6 +895,16 @@ static void replenish_dl_entity(struct s
> dl_se->dl_yielded = 0;
> if (dl_se->dl_throttled)
> dl_se->dl_throttled = 0;
> +
> + /*
> + * If this is a zero-laxity task, and we're before the zero-laxity
> + * point, throttle it.
> + */
> + if (dl_se->dl_zerolax &&
> + dl_time_before(dl_se->deadline - dl_se->runtime, rq_clock(rq))) {
> + if (!is_dl_boosted(dl_se) && start_dl_timer(dl_se))
> + dl_se->dl_throttled = 1;
> + }
> }
>
> /*
> @@ -1078,7 +1088,12 @@ static int start_dl_timer(struct sched_d
> * that it is actually coming from rq->clock and not from
> * hrtimer's time base reading.
> */
> - act = ns_to_ktime(dl_next_period(dl_se));
> + if (dl_se->dl_zerolax && !dl_se->dl_throttled) {
> + act = ns_to_ktime(dl_se->deadline - dl_se->runtime);
> + } else {
> + act = ns_to_ktime(dl_next_period(dl_se));
> + }
> +
> now = hrtimer_cb_get_time(timer);
> delta = ktime_to_ns(now) - rq_clock(rq);
> act = ktime_add_ns(act, delta);
> @@ -1794,6 +1809,13 @@ enqueue_dl_entity(struct sched_dl_entity
> setup_new_dl_entity(dl_se);
> }
>
> + /*
> + * If we are still throttled, eg. we got replenished but are a
> + * zero-laxity task and still got to wait, don't enqueue.
> + */
> + if (dl_se->dl_throttled)
> + return;
> +
> __enqueue_dl_entity(dl_se);
> }
Let me see if I got it:
- Always start the server, but throttled with full runtime...
- Unconditionally decrement fair_server.dl_runtime from update_curr_fair()
(check if it is not decremented twice as it runs)
- When the dl timer fire, replenish or throttle for the next period?
is that the base for it?
-- Daniel
next prev parent reply other threads:[~2023-09-08 15:28 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
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 [this message]
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=658f807e-7f7a-e6d2-25e7-00eb2187af2a@kernel.org \
--to=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=peterz@infradead.org \
--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