From: Daniel Bristot de Oliveira <bristot@redhat.com>
To: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@arm.com>,
Tommaso Cucinotta <tommaso.cucinotta@sssup.it>,
Luca Abeni <luca.abeni@santannapisa.it>,
Steven Rostedt <rostedt@goodmis.org>,
Mike Galbraith <efault@gmx.de>,
Romulo Silva de Oliveira <romulo.deoliveira@ufsc.br>
Subject: [PATCH V4 0/3] sched/deadline: Fixes for constrained deadline tasks
Date: Thu, 2 Mar 2017 15:10:56 +0100 [thread overview]
Message-ID: <cover.1488392936.git.bristot@redhat.com> (raw)
While reading sched deadline code, I find out that a constrained
deadline task could be replenished before the next period if
activated after the deadline, opening the window to run for more
than Q/P. The patch [2] explains and fixes this problem.
Furthermore, while fixing this issue, I found that the replenishment
timer was being fired at the deadline of the task. This works fine
for implicit deadline tasks (deadline == period) because the deadline
is at the same point in time of the next period. But that is not true
for constrained deadline tasks (deadline < period). This problem is
not as visible as the first because the runtime leakage takes
place only in the second activation. Next activations receive the
correct bandwidth. However, after the 2nd activation, tasks are
activated in the (period - dl_deadline) instant, which is before
the expected activation. This problem is explained in the fix
description as well.
While testing these fixes, Rostedt tweaked the test case a little.
Instead of having the runtime equal to the deadline, he increased
the deadline ten fold. Then, the task started using much more than
.1% of the CPU. More like 20%. Looking into this he found that it
was due to the dl_entity_overflow() constantly returning true. That's
because it uses the relative period against relative runtime vs the
absolute deadline against absolute runtime. As we care about if the
runtime can make its deadline, not its period, we need to use the
task's density in the check, not the task's utilization. After
correcting this, now when the task gets enqueued, it can throttle
correctly.
Changes from V3:
- Fixes grammar errors in the patch 2/3. (Steven Rostedt)
- I was checking if the pi_se was constrained, not the task being
awakened.
This was not causing problems in the test case because
pi_se = &p->dl, but this would be a problem if we were activating
the task in a PI case:
It would check the pi-waiter, not the task being awakened (p).
Changes from V2:
- Fixes dl_entity_overflow(): (Steven Rostedt)
Patch 3/3 fixes the dl_entity_overflow() for constrained deadline
tasks by using the density, not the utilization.
(as deadline <= period, deadline is always == min(deadline, period))
Changes from V1:
- Fix a broken comment style. (Peter Zijlstra)
- Fixes dl_is_constrained(). (Steven Rostedt)
A constrained deadline task has dl_deadline < dl_period; so
"dl_runtime < dl_period"; s/runtime/deadline/
Daniel Bristot de Oliveira (2):
sched/deadline: Replenishment timer should fire in the next period
sched/deadline: Throttle a constrained deadline task activated after
the deadline
Steven Rostedt (VMware) (1):
sched/deadline: Use deadline instead of period when calculating
overflow
kernel/sched/deadline.c | 62 ++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 56 insertions(+), 6 deletions(-)
--
2.9.3
next reply other threads:[~2017-03-02 14:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-02 14:10 Daniel Bristot de Oliveira [this message]
2017-03-02 14:10 ` [PATCH V4 1/3] sched/deadline: Replenishment timer should fire in the next period Daniel Bristot de Oliveira
2017-03-07 7:51 ` Wanpeng Li
2017-03-16 11:15 ` [tip:sched/core] sched/deadline: Make sure the replenishment timer fires " tip-bot for Daniel Bristot de Oliveira
2017-03-02 14:10 ` [PATCH V4 2/3] sched/deadline: Throttle a constrained deadline task activated after the deadline Daniel Bristot de Oliveira
2017-03-06 15:51 ` Luca Abeni
2017-03-07 7:52 ` Wanpeng Li
2017-03-16 11:15 ` [tip:sched/core] " tip-bot for Daniel Bristot de Oliveira
2017-03-02 14:10 ` [PATCH V4 3/3] sched/deadline: Use deadline instead of period when calculating overflow Daniel Bristot de Oliveira
2017-03-07 7:53 ` Wanpeng Li
2017-03-16 11:16 ` [tip:sched/core] " tip-bot for Steven Rostedt (VMware)
2017-03-15 16:18 ` [PATCH V4 0/3] sched/deadline: Fixes for constrained deadline tasks Daniel Bristot de Oliveira
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=cover.1488392936.git.bristot@redhat.com \
--to=bristot@redhat.com \
--cc=efault@gmx.de \
--cc=juri.lelli@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).