From: Juri Lelli <juri.lelli@gmail.com>
To: Luca Abeni <luca.abeni@unitn.it>, Steven Rostedt <rostedt@goodmis.org>
Cc: peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com,
oleg@redhat.com, fweisbec@gmail.com, darren@dvhart.com,
johan.eker@ericsson.com, p.faure@akatech.ch,
linux-kernel@vger.kernel.org, claudio@evidence.eu.com,
michael@amarulasolutions.com, fchecconi@gmail.com,
tommaso.cucinotta@sssup.it, nicola.manica@disi.unitn.it,
dhaval.giani@gmail.com, hgu1972@gmail.com,
paulmck@linux.vnet.ibm.com, raistlin@linux.it,
insop.song@gmail.com, liming.wang@windriver.com,
jkacur@redhat.com, harald.gustafsson@ericsson.com,
vincent.guittot@linaro.org, bruce.ashfield@windriver.com,
linux-doc@vger.kernel.org, rob@landley.net
Subject: Re: [PATCH] sched/deadline: Add sched_dl documentation
Date: Tue, 28 Jan 2014 11:03:08 +0100 [thread overview]
Message-ID: <52E7805C.8050907@gmail.com> (raw)
In-Reply-To: <20140127232922.667593ca@luca-1225C>
On 01/27/2014 11:29 PM, Luca Abeni wrote:
> Hi Steven,
>
> On Mon, 27 Jan 2014 12:09:38 -0500
> Steven Rostedt <rostedt@goodmis.org> wrote:
> [...]
>>>> Lets take a case where deadline == period. It seems that the above
>>>> would be true any time there was any delay to starting the task
>>>> or the task was interrupted by another SCHED_DEADLINE task.
>>> Not sure about this... Notice that above only applies when a task
>>> wakes up (moving from a "sleeping" state to a "ready to run"
>>> state). Not when an already ready task is scheduled.
>>> Or did I misunderstand your comment?
>>
>> No no, you understood, I missed that this only happens on wakeup. But
>> then I have to ask, what happens if the task blocks on a mutex? Would
>> that cause this check to happen then?
> Well, in theory, this check has to be performed every time the task
> wakes up from any kind of sleeping (mutex, or anything else).
> I think this is what happens in practice with the current
> implementation, but maybe I am missing something in the implementation
> details.
>
Yes. The call graph looks like:
enqueue_task_dl()
-> enqueue_dl_entity()
-> update_dl_entity() <-- this does the check through dl_entity_overflow()
and enqueue_task_dl() gets called every time the task wakes up and is enqueued
back in the dl_rq (e.g., it was waiting on a mutex).
Thanks,
- Juri
>> It may be nice to add some comments about exactly when this check is
>> performed.
> Well, maybe "wake-up" is not the right term according to the
> terminology used in the Linux kernel... The check should be performed
> every time the task changes its state from sleeping (TASK_INTERRUPTIBLE
> or TASK_UNINTERRUPTIBLE, I think) to "ready to execute" (TASK_RUNNING,
> I think) and enters the ready queue (well, RB tree :). If someone can
> suggest a more appropriate wording, I'll fix the document accordingly.
>
>
>>>> For example, lets say we have two SD tasks. One that has 50ms
>>>> runtime and a 100ms period. The other has a 1ms runtime and a
>>>> 10ms period.
>>>>
>>>> The above two should work perfectly fine together. The 10ms period
>>>> task will constantly schedule in on the 100ms task.
>>>>
>>>> When the 100ms task runs, it could easily be delayed by 1ms due
>>>> to the 10ms task. Then lets look at the above equation
>>> See above: the check for the 100ms task is only performed when the
>>> task unblocks (at the beginning of its period), not when it's
>>> scheduled (after the 10ms taks).
>>>
>>> This check is designed to take care of the following situation:
>>> - consider a task with runtime 10ms and period equal to deadline
>>> equal to 100ms
>>> - assume the task wakes up at time t, and is assigned "remaining
>>> runtime" 10ms and "scheduling deadline" t+100ms
>>> - assume the task blocks after executing for 2ms. The "remaining
>>> runtime" is now 8ms
>>> - can the task use "remaining runtime" 8ms and "scheduling deadline"
>>> t+100ms when it wakes up again?
>>> Answer: if it wakes up before t+20ms, it can. Otherwise, it
>>> cannot, because it would consume a fraction of CPU time larger than
>>> 10%, causing missed deadlines in other tasks.
>>
>> Ah, you answered my question here. The check happens every time the
>> task blocks as well. I still need to read the papers, and even more
>> importantly, start running more tests with tracing on to review what
>> exactly happens in the implementation.
> If you read the original CBS paper, you'll see that it does not talk
> about "wake-up" and "sleep", because it always considers a wake-up as a
> job arrival, and a task blocking as a job end. This is because the
> original paper only considers a simplified task model, without
> "self-suspending jobs".
> In SCHED_DEADLINE, things are not so simple, because it has to consider
> real situations with real tasks not using the simplified original
> real-time task model...
>
>>>>> + SCHED_DEADLINE can be used to schedule real-time tasks
>>>>> guaranteeing that
>>>>> + the jobs' deadlines of a task are respected. In order to do
>>>>> this, a task
>>>>> + must be scheduled by setting:
>>>>> +
>>>>> + - runtime >= WCET
>>>>> + - deadline = D
>>>>> + - period <= P
>>>>> +
>>>>> + IOW, if runtime >= WCET and if period is >= P, then the
>>>>> scheduling deadlines
>>>>> + and the absolute deadlines (d_j) coincide, so a proper
>>>>> admission control
>>>>> + allows to respect the jobs' absolute deadlines for this task
>>>>> (this is what is
>>>>> + called "hard schedulability property" and is an extension of
>>>>> Lemma 1 of [2]).
>>>>
>>>> I wonder if we should state the obvious (which is never obvious).
>>>> That is the user must also have the following.
>>>>
>>>> runtime < deadline <= period
>>>>
>>>> Although it is fine for deadline = period, runtime should be less
>>>> than deadline, otherwise the task will take over the system.
>>> I think if "runtime < deadline <= period" is not respected, then the
>>> admission control will fail... But yes, repeating it here can be
>>> useful. If needed I'll add it to the document.
>>
>> Yeah, it's one of those things that you should know, but I can see
>> users screwing it up ;-)
> Ok...
> What about presenting this as an example of the admission test failing?
> Something like: 'notice that if "runtime" > "deadine" the admission
> test will surely fail.'
> (BTW, I am not sure if the "deadline <= period" condition is really
> needed... Maybe not respecting it does not make too much sense, but I
> think it is not strictly needed for schedulability purposes).
>
>
>
> Thanks,
> Luca
>
next prev parent reply other threads:[~2014-01-28 10:03 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-27 11:20 [PATCH] sched/deadline: Add sched_dl documentation Juri Lelli
2014-01-27 11:23 ` Juri Lelli
2014-01-27 11:53 ` Henrik Austad
2014-01-27 12:30 ` Luca Abeni
2014-01-27 12:40 ` Henrik Austad
2014-01-27 12:52 ` Luca Abeni
2014-01-27 15:35 ` Steven Rostedt
2014-01-27 16:56 ` Luca Abeni
2014-01-27 17:09 ` Steven Rostedt
2014-01-27 22:29 ` Luca Abeni
2014-01-28 10:03 ` Juri Lelli [this message]
2014-01-28 19:22 ` [tip:sched/numa] " tip-bot for Dario Faggioli
-- strict thread matches above, loose matches on Subject: below --
2014-01-20 10:40 [PATCH] " Juri Lelli
2014-01-20 11:24 ` Henrik Austad
2014-01-20 11:46 ` Peter Zijlstra
2014-01-21 14:55 ` Steven Rostedt
2014-01-20 12:15 ` Juri Lelli
2014-01-20 13:16 ` Henrik Austad
2014-01-20 13:39 ` Luca Abeni
2014-01-21 10:20 ` Henrik Austad
2014-01-21 11:35 ` Luca Abeni
2014-01-21 12:11 ` Juri Lelli
2014-01-21 12:33 ` Peter Zijlstra
2014-01-21 12:50 ` Luca Abeni
2014-01-21 13:55 ` Peter Zijlstra
2014-01-21 14:38 ` Juri Lelli
2014-01-21 16:28 ` Steven Rostedt
2014-01-22 13:03 ` Luca Abeni
2014-01-22 13:51 ` Peter Zijlstra
2014-01-24 10:08 ` Tommaso Cucinotta
2014-01-28 9:31 ` Peter Zijlstra
2014-01-28 18:22 ` Tommaso Cucinotta
2014-01-21 10:21 ` Henrik Austad
2014-01-20 12:25 ` Luca Abeni
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=52E7805C.8050907@gmail.com \
--to=juri.lelli@gmail.com \
--cc=bruce.ashfield@windriver.com \
--cc=claudio@evidence.eu.com \
--cc=darren@dvhart.com \
--cc=dhaval.giani@gmail.com \
--cc=fchecconi@gmail.com \
--cc=fweisbec@gmail.com \
--cc=harald.gustafsson@ericsson.com \
--cc=hgu1972@gmail.com \
--cc=insop.song@gmail.com \
--cc=jkacur@redhat.com \
--cc=johan.eker@ericsson.com \
--cc=liming.wang@windriver.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@unitn.it \
--cc=michael@amarulasolutions.com \
--cc=mingo@redhat.com \
--cc=nicola.manica@disi.unitn.it \
--cc=oleg@redhat.com \
--cc=p.faure@akatech.ch \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=raistlin@linux.it \
--cc=rob@landley.net \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tommaso.cucinotta@sssup.it \
--cc=vincent.guittot@linaro.org \
/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