summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Lelli <juri.lelli@gmail.com>2012-04-07 10:58:33 +0200
committerJuri Lelli <juri.lelli@gmail.com>2012-04-07 10:58:33 +0200
commitad51d929f3711096d69c2215f83597def316a868 (patch)
tree698c45eca35437b1e5ce8d526267ac0070de2e19
parentd2b8bc9f4cd5e3b4848746ce54b90fe630ca1882 (diff)
Set to SCHED_DEADLINE as far as possible.
In the case the user wants its tasks to be scheduled by SCHED_DEADLINE call sched_setscheduler2 just before the start of the main loop. This affect the first iteration budget as little as possible.
-rw-r--r--src/rt-app.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/rt-app.c b/src/rt-app.c
index 99f60e5..cb6d31d 100644
--- a/src/rt-app.c
+++ b/src/rt-app.c
@@ -252,12 +252,18 @@ void *thread_body(void *arg)
"\tBudget\tUsed Budget\n");
#ifdef DLSCHED
- ret = sched_setscheduler2(tid, SCHED_DEADLINE,
- &param2);
- if (ret != 0) {
- log_critical("[%d] sched_setscheduler2 "
- "returned %d", data->ind, ret);
- exit(EXIT_FAILURE);
+ /*
+ * Set the task to SCHED_DEADLINE as far as possible touching its
+ * budget as little as possible for the first iteration.
+ */
+ if (data->sched_policy == SCHED_DEADLINE) {
+ ret = sched_setscheduler2(tid, SCHED_DEADLINE,
+ &param2);
+ if (ret != 0) {
+ log_critical("[%d] sched_setscheduler2 "
+ "returned %d", data->ind, ret);
+ exit(EXIT_FAILURE);
+ }
}
#endif