From: Luca Abeni <luca.abeni@santannapisa.it>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Juri Lelli <juri.lelli@arm.com>,
Tommaso Cucinotta <tommaso.cucinotta@sssup.it>,
Mike Galbraith <efault@gmx.de>,
Romulo Silva de Oliveira <romulo.deoliveira@ufsc.br>
Subject: Re: [PATCH 3/2] sched/deadline: Use deadline instead of period when calculating overflow
Date: Wed, 15 Feb 2017 08:40:03 +0100 [thread overview]
Message-ID: <20170215084003.4d123e5b@luca> (raw)
In-Reply-To: <20170214191417.4dd96145@gandalf.local.home>
Hi Steven,
On Tue, 14 Feb 2017 19:14:17 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
[...]
> > I am not sure about the correct fix (wouldn't
> > "runtime / (deadline - t) > dl_runtime / dl_deadline" allow the
> > task to use a fraction of CPU time equal to dl_runtime /
> > dl_deadline?)
> >
> > The current code is clearly wrong (as shown by Daniel), but I do not
> > understand how the current check can allow the task to consume more
> > than dl_runtime / dl_period... I need some more time to think about
> > this issue.
> >
>
> This is in dl_entity_overflow() which is called by update_dl_entity()
> which has this:
>
> if (dl_time_before(dl_se->deadline, rq_clock(rq)) ||
> dl_entity_overflow(dl_se, pi_se, rq_clock(rq))) {
> dl_se->deadline = rq_clock(rq) + pi_se->dl_deadline;
> dl_se->runtime = pi_se->dl_runtime;
> }
>
>
> The comments in this code state:
>
> * The policy here is that we update the deadline of the entity only
> if:
> * - the current deadline is in the past,
> * - using the remaining runtime with the current deadline would make
> * the entity exceed its bandwidth.
>
> That second comment is saying that when this task woke up, if the
> percentage left to run will exceed its bandwidth with the rest of the
> system then reset its deadline and its runtime.
Right; this is the problem. When the relative deadline is different
from the period, the term "bandwidth" is ambiguous... We can consider
the utilisation (maximum runtime / period), or the density (maximum
runtime / relative deadline). In some sense, the two approaches are
both correct (if we use density, we are more pessimistic but we try to
respect deadlines in a hard way; if we use utilisation, we allow more
tasks to be admitted but we can only provide bounded tardiness).
What the current code is doing is to mix the two approaches (resulting
in a wrong runtime/deadline assignment).
> What happens in the current logic, is that overflow() check says, when
> the deadline is much smaller than the period, "yeah, we're going to
> exceed our percentage!" so give us more, even though it wont exceed
> its percentage if we compared runtime with deadline.
>
> The relative-runtime / relative-period is a tiny percentage, which
> does not reflect the percentage that the task is allowed to have
> before the deadline is hit. The tasks bandwidth should be calculated
> by the relative-runtime / relative-deadline, as runtime <= deadline
> <= period, and the runtime should happen within the deadline.
>
> When the task wakes up, it currently looks at how much time is left
> absolute-deadline - t, and compares it to the amount of runtime left.
> The percentage allowed should still be compared with the percentage
> between relative-runtime and relative-deadline. The relative-period or
> even absolute-period, should have no influence in this decision.
Ok, thanks; I think I can now see why this can result in a task
consuming more than the reserved utilisation. I still need some time to
convince me that "runtime / (deadline - t) > dl_runtime / dl_deadline"
is the correct check to use (in this case, shouldn't we also change the
admission test to use densities instead of utilisations?)
Thanks,
Luca
next prev parent reply other threads:[~2017-02-15 7:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-13 19:05 [PATCH V2 0/2] sched/deadline: Fixes for constrained deadline tasks Daniel Bristot de Oliveira
2017-02-13 19:05 ` [PATCH V2 1/2] sched/deadline: Replenishment timer should fire in the next period Daniel Bristot de Oliveira
2017-02-13 19:05 ` [PATCH V2 2/2] sched/deadline: Throttle a constrained deadline task activated after the deadline Daniel Bristot de Oliveira
2017-02-14 15:54 ` Tommaso Cucinotta
2017-02-14 17:31 ` Daniel Bristot de Oliveira
2017-02-14 19:33 ` Steven Rostedt
2017-02-14 19:28 ` [PATCH 3/2] sched/deadline: Use deadline instead of period when calculating overflow Steven Rostedt (VMware)
2017-02-14 22:49 ` luca abeni
2017-02-15 0:14 ` Steven Rostedt
2017-02-15 7:40 ` Luca Abeni [this message]
2017-02-15 10:29 ` Juri Lelli
2017-02-15 11:32 ` Peter Zijlstra
2017-02-15 12:31 ` Luca Abeni
2017-02-15 12:59 ` Juri Lelli
2017-02-15 13:13 ` Luca Abeni
2017-02-15 14:15 ` Juri Lelli
2017-02-15 13:33 ` Daniel Bristot de Oliveira
2017-02-15 13:42 ` Daniel Bristot de Oliveira
2017-02-15 14:09 ` Steven Rostedt
2017-02-15 14:16 ` Juri Lelli
2017-02-16 16:36 ` Tommaso Cucinotta
2017-02-16 16:47 ` Steven Rostedt
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=20170215084003.4d123e5b@luca \
--to=luca.abeni@santannapisa.it \
--cc=bristot@redhat.com \
--cc=efault@gmx.de \
--cc=juri.lelli@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=romulo.deoliveira@ufsc.br \
--cc=rostedt@goodmis.org \
--cc=tommaso.cucinotta@sssup.it \
/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.