From 181b6bb0f5f122741262edc7ac0eca86d3f6dd73 Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Tue, 5 Mar 2013 20:03:04 -0500 Subject: EDF schedulers: Support early job releasing. This patch allows a task to request early releasing via rt_task parameters to sys_set_task_rt_param(). Note that early releasing can easily peg your CPUs since early-releasing tasks never suspend to wait for their next job. As such, early releasing is really only useful in the context of implementing bandwidth servers, interrupt handling threads (or any thread that spends most of its time waiting for an event), or short-lived computations. If early releasing pegs your CPUs, then you probably shouldn't be using it. --- litmus/Kconfig | 21 +++++++++++++++++++++ litmus/sched_cedf.c | 4 ++-- litmus/sched_gsn_edf.c | 4 ++-- litmus/sched_psn_edf.c | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) (limited to 'litmus') diff --git a/litmus/Kconfig b/litmus/Kconfig index bd6635c8de08..795fbe1a769e 100644 --- a/litmus/Kconfig +++ b/litmus/Kconfig @@ -79,6 +79,27 @@ config SCHED_CPU_AFFINITY Say Yes if unsure. +config ALLOW_EARLY_RELEASE + bool "Allow Early Releasing" + default y + help + Allow tasks to release jobs early (while still maintaining job + precedence constraints). Only supported by EDF schedulers. Early + releasing must be explicitly requested by real-time tasks via + the task_params passed to sys_set_task_rt_param(). + + Early releasing can improve job response times while maintaining + real-time correctness. However, it can easily peg your CPUs + since tasks never suspend to wait for their next job. As such, early + releasing is really only useful in the context of implementing + bandwidth servers, interrupt handling threads, or short-lived + computations. + + Beware that early releasing may affect real-time analysis + if using locking protocols or I/O. + + Say Yes if unsure. + choice prompt "EDF Tie-Break Behavior" default EDF_TIE_BREAK_LATENESS_NORM diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c index 4c2b150fa22d..ba3ed4525421 100644 --- a/litmus/sched_cedf.c +++ b/litmus/sched_cedf.c @@ -254,7 +254,7 @@ static noinline void requeue(struct task_struct* task) /* sanity check before insertion */ BUG_ON(is_queued(task)); - if (is_released(task, litmus_clock())) + if (wants_early_release(task) || is_released(task, litmus_clock())) __add_ready(&cluster->domain, task); else { /* it has got to wait */ @@ -353,7 +353,7 @@ static noinline void job_completion(struct task_struct *t, int forced) tsk_rt(t)->completed = 1; /* prepare for next period */ prepare_for_next_period(t); - if (is_released(t, litmus_clock())) + if (wants_early_release(t) || is_released(t, litmus_clock())) sched_trace_task_release(t); /* unlink */ unlink(t); diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c index 8fdc8f68fcfb..ac5c4d836018 100644 --- a/litmus/sched_gsn_edf.c +++ b/litmus/sched_gsn_edf.c @@ -251,7 +251,7 @@ static noinline void requeue(struct task_struct* task) /* sanity check before insertion */ BUG_ON(is_queued(task)); - if (is_released(task, litmus_clock())) + if (wants_early_release(task) || is_released(task, litmus_clock())) __add_ready(&gsnedf, task); else { /* it has got to wait */ @@ -344,7 +344,7 @@ static noinline void job_completion(struct task_struct *t, int forced) tsk_rt(t)->completed = 1; /* prepare for next period */ prepare_for_next_period(t); - if (is_released(t, litmus_clock())) + if (wants_early_release(t) || is_released(t, litmus_clock())) sched_trace_task_release(t); /* unlink */ unlink(t); diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c index c158f3532ba6..316333460dd9 100644 --- a/litmus/sched_psn_edf.c +++ b/litmus/sched_psn_edf.c @@ -61,7 +61,7 @@ static void requeue(struct task_struct* t, rt_domain_t *edf) TRACE_TASK(t, "requeue: !TASK_RUNNING\n"); tsk_rt(t)->completed = 0; - if (is_released(t, litmus_clock())) + if (wants_early_release(t) || is_released(t, litmus_clock())) __add_ready(edf, t); else add_release(edf, t); /* it has got to wait */ -- cgit v1.2.2