From 900f57d54aab6fc690168b37cfe349db001689da Mon Sep 17 00:00:00 2001 From: Luca Abeni Date: Wed, 22 Jan 2014 12:51:13 +0100 Subject: [PATCH 1/6] Add a more detailed SCHED_DEADLINE description --- Documentation/scheduler/sched-deadline.txt | 38 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/Documentation/scheduler/sched-deadline.txt b/Documentation/scheduler/sched-deadline.txt index 727957b34ea341..8b898c20b7d0b1 100644 --- a/Documentation/scheduler/sched-deadline.txt +++ b/Documentation/scheduler/sched-deadline.txt @@ -6,7 +6,7 @@ CONTENTS 0. WARNING 1. Overview - 2. Task scheduling + 2. Scheduling algorithm 3. Scheduling Real-Time Tasks 4. Bandwidth management 4.1 System-wide settings @@ -34,7 +34,7 @@ CONTENTS that makes it possible to isolate the behavior of tasks between each other. -2. Task scheduling +2. Scheduling algorithm ================== SCHED_DEADLINE uses three parameters, named "runtime", "period", and @@ -55,6 +55,40 @@ CONTENTS strictly comply with the "traditional" real-time task model (see Section 3) can effectively use the new policy. + In more details, the CBS algorithm assigns scheduling deadlines to + tasks in the following way: + + - Each SCHED_DEADLINE task is characterised by the "runtime", + "deadline", and "period" parameters + - The state of the task is described by a "scheduling deadline", and + a "current runtime". These two parameters are initially set to 0 + - When a SCHED_DEADLINE task wakes up (becomes ready for execution), + the scheduler checks if + current runtime runtime + ---------------------------------- > ---------------- + scheduling deadline - current time period + if the scheduling deadline is smaller than the current time, or + this condition is verified, then the scheduling deadline and the + current budget are re-initialised as + scheduling deadline = current time + deadline + current runtime = runtime + otherwise, the scheduling deadline and the current runtime are + left unchanged + - When a SCHED_DEADLINE task executes for an amount of time t, its + current runtime is decreased as + current runtime = current runtime - t + (technically, the runtime is decreased at every tick, or when the + task is descheduled / preempted) + - When the current runtime becomes less or equal than 0, the task is + said to be "depleted" and cannot be scheduled until its scheduling + deadline + - When the current time is equal to the scheduling deadline of a + depleted task, the scheduling deadline and the current runtime are + updated as + scheduling deadline = scheduling deadline + deadline + current runtime = current runtime + runtime + + 3. Scheduling Real-Time Tasks ============================= From aad5d75258fa989dd39531127035413107f2e079 Mon Sep 17 00:00:00 2001 From: Luca Abeni Date: Wed, 22 Jan 2014 13:12:37 +0100 Subject: [PATCH 2/6] Few corrections to the real-time tasks section --- Documentation/scheduler/sched-deadline.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Documentation/scheduler/sched-deadline.txt b/Documentation/scheduler/sched-deadline.txt index 8b898c20b7d0b1..5d29cb14ef4c04 100644 --- a/Documentation/scheduler/sched-deadline.txt +++ b/Documentation/scheduler/sched-deadline.txt @@ -104,11 +104,12 @@ CONTENTS There are no limitations on what kind of task can exploit this new scheduling discipline, even if it must be said that it is particularly - suited for periodic or sporadic tasks that need guarantees on their + suited for periodic or sporadic real-time tasks that need guarantees on their timing behavior, e.g., multimedia, streaming, control applications, etc. - A typical real-time task is composed of a computation phase (task instance, - or job) which is activated on a periodic or sporadic fashion. + A typical real-time task is composed of a repetition of computation phases + (task instances, or jobs) which are activated on a periodic or sporadic + fashion. Each job J_j (where J_j is the j^th job of the task) is characterised by an arrival time r_j (the time when the job starts), an amount of computation time c_j needed to finish the job, and a job absolute deadline d_j, which @@ -127,9 +128,9 @@ CONTENTS - period <= P IOW, if runtime >= WCET and if period is >= P, then the scheduling deadlines - and the absolute deadlines (d_j) coincide, so the task is guaranteed to - respect the jobs' absolute deadlines (this is what is called "hard - schedulability property" in the CBS paper[2]). + 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]). References: 1 - C. L. Liu and J. W. Layland. Scheduling algorithms for multiprogram- From 538c068d21ee46fc72344c29118d65cb5ce2ada9 Mon Sep 17 00:00:00 2001 From: Luca Abeni Date: Wed, 22 Jan 2014 13:25:33 +0100 Subject: [PATCH 3/6] Mention admission control where appropriate The CBS guarantee can only be provided if a proper admission control is enforced... Mention this as early as possible. --- Documentation/scheduler/sched-deadline.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/scheduler/sched-deadline.txt b/Documentation/scheduler/sched-deadline.txt index 5d29cb14ef4c04..903c35b8ea94b4 100644 --- a/Documentation/scheduler/sched-deadline.txt +++ b/Documentation/scheduler/sched-deadline.txt @@ -45,7 +45,9 @@ CONTENTS every time the task wakes up, the scheduler computes a "scheduling deadline" consistent with the guarantee (using the CBS[2,3] algorithm). Tasks are then scheduled using EDF[1] on these scheduling deadlines (the task with the - smallest scheduling deadline is selected for execution). + smallest scheduling deadline is selected for execution). Notice that this + guaranteed is respected if a proper "admission control" strategy (see Section + "4. Bandwidth management") is used. Summing up, the CBS[2,3] algorithms assigns scheduling deadlines to tasks so that each task runs for at most its runtime every period, avoiding any From 257a9724effd2d67eb9d52fed402e62196072788 Mon Sep 17 00:00:00 2001 From: Luca Abeni Date: Wed, 22 Jan 2014 14:45:13 +0100 Subject: [PATCH 4/6] Change "depleted" in "throttled" "throttled" is more in line with the Linux kernel naming. Anyway, keep a reference to the term commonly used in literature. --- Documentation/scheduler/sched-deadline.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/scheduler/sched-deadline.txt b/Documentation/scheduler/sched-deadline.txt index 903c35b8ea94b4..5a44c278103317 100644 --- a/Documentation/scheduler/sched-deadline.txt +++ b/Documentation/scheduler/sched-deadline.txt @@ -82,10 +82,10 @@ CONTENTS (technically, the runtime is decreased at every tick, or when the task is descheduled / preempted) - When the current runtime becomes less or equal than 0, the task is - said to be "depleted" and cannot be scheduled until its scheduling - deadline + said to be "throttled" (also known as "depleted" in real-time literature) + and cannot be scheduled until its scheduling deadline - When the current time is equal to the scheduling deadline of a - depleted task, the scheduling deadline and the current runtime are + throttled task, the scheduling deadline and the current runtime are updated as scheduling deadline = scheduling deadline + deadline current runtime = current runtime + runtime From ba3e7bb80a9fc11bf3c6a687d888f6e00eedb9b2 Mon Sep 17 00:00:00 2001 From: Luca Abeni Date: Wed, 22 Jan 2014 14:46:46 +0100 Subject: [PATCH 5/6] Fix a cut'n'paste typo --- Documentation/scheduler/sched-deadline.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/scheduler/sched-deadline.txt b/Documentation/scheduler/sched-deadline.txt index 5a44c278103317..f7026c8e209cb4 100644 --- a/Documentation/scheduler/sched-deadline.txt +++ b/Documentation/scheduler/sched-deadline.txt @@ -87,7 +87,7 @@ CONTENTS - When the current time is equal to the scheduling deadline of a throttled task, the scheduling deadline and the current runtime are updated as - scheduling deadline = scheduling deadline + deadline + scheduling deadline = scheduling deadline + period current runtime = current runtime + runtime From 148195499e32cd73f3be568050761a7986a95127 Mon Sep 17 00:00:00 2001 From: Luca Abeni Date: Wed, 22 Jan 2014 14:49:36 +0100 Subject: [PATCH 6/6] Introduce the "replenishment time" concept --- Documentation/scheduler/sched-deadline.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/scheduler/sched-deadline.txt b/Documentation/scheduler/sched-deadline.txt index f7026c8e209cb4..d74492db18ca63 100644 --- a/Documentation/scheduler/sched-deadline.txt +++ b/Documentation/scheduler/sched-deadline.txt @@ -83,8 +83,10 @@ CONTENTS task is descheduled / preempted) - When the current runtime becomes less or equal than 0, the task is said to be "throttled" (also known as "depleted" in real-time literature) - and cannot be scheduled until its scheduling deadline - - When the current time is equal to the scheduling deadline of a + and cannot be scheduled until its scheduling deadline. The "replenishment + time" for this task (see next item) is set to be equal to the current + value of the scheduling deadline + - When the current time is equal to the replenishment time of a throttled task, the scheduling deadline and the current runtime are updated as scheduling deadline = scheduling deadline + period