aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
Diffstat (limited to 'litmus')
-rw-r--r--litmus/jobs.c29
-rw-r--r--litmus/litmus.c16
-rw-r--r--litmus/rt_domain.c5
-rw-r--r--litmus/sched_pfair.c2
4 files changed, 24 insertions, 28 deletions
diff --git a/litmus/jobs.c b/litmus/jobs.c
index 44dd133a295a..bc8246572e54 100644
--- a/litmus/jobs.c
+++ b/litmus/jobs.c
@@ -6,15 +6,13 @@
6#include <litmus/litmus.h> 6#include <litmus/litmus.h>
7#include <litmus/jobs.h> 7#include <litmus/jobs.h>
8 8
9 9static inline void setup_release(struct task_struct *t, lt_t release)
10void prepare_for_next_period(struct task_struct *t)
11{ 10{
12 BUG_ON(!t);
13 /* prepare next release */ 11 /* prepare next release */
14 t->rt_param.job_params.release += get_rt_period(t); 12 t->rt_param.job_params.release = release;
15 t->rt_param.job_params.deadline = t->rt_param.job_params.release 13 t->rt_param.job_params.deadline = release + get_rt_relative_deadline(t);
16 + get_rt_rdeadline(t);
17 t->rt_param.job_params.exec_time = 0; 14 t->rt_param.job_params.exec_time = 0;
15
18 /* update job sequence number */ 16 /* update job sequence number */
19 t->rt_param.job_params.job_no++; 17 t->rt_param.job_params.job_no++;
20 18
@@ -22,21 +20,16 @@ void prepare_for_next_period(struct task_struct *t)
22 t->rt.time_slice = 1; 20 t->rt.time_slice = 1;
23} 21}
24 22
25void release_at(struct task_struct *t, lt_t start) 23void prepare_for_next_period(struct task_struct *t)
26{ 24{
27 BUG_ON(!t); 25 BUG_ON(!t);
26 setup_release(t, get_release(t) + get_rt_period(t));
27}
28 28
29 /* prepare next release */ 29void release_at(struct task_struct *t, lt_t start)
30 t->rt_param.job_params.release = start; 30{
31 t->rt_param.job_params.deadline = start + get_rt_rdeadline(t); 31 BUG_ON(!t);
32 t->rt_param.job_params.exec_time = 0; 32 setup_release(t, start);
33
34 /* update job sequence number */
35 t->rt_param.job_params.job_no++;
36
37 /* don't confuse Linux */
38 t->rt.time_slice = 1;
39
40 set_rt_flags(t, RT_F_RUNNING); 33 set_rt_flags(t, RT_F_RUNNING);
41} 34}
42 35
diff --git a/litmus/litmus.c b/litmus/litmus.c
index 0ee0926f37d3..19de1201d964 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -103,8 +103,8 @@ asmlinkage long sys_set_rt_task_param(pid_t pid, struct rt_task __user * param)
103 } 103 }
104 104
105 /* set relative deadline to be implicit if left unspecified */ 105 /* set relative deadline to be implicit if left unspecified */
106 if (tp.rdeadline == 0) 106 if (tp.relative_deadline == 0)
107 tp.rdeadline = tp.period; 107 tp.relative_deadline = tp.period;
108 108
109 if (tp.exec_cost <= 0) 109 if (tp.exec_cost <= 0)
110 goto out_unlock; 110 goto out_unlock;
@@ -112,10 +112,10 @@ asmlinkage long sys_set_rt_task_param(pid_t pid, struct rt_task __user * param)
112 goto out_unlock; 112 goto out_unlock;
113 if (!cpu_online(tp.cpu)) 113 if (!cpu_online(tp.cpu))
114 goto out_unlock; 114 goto out_unlock;
115 if (tp.rdeadline < tp.exec_cost) 115 if (min(tp.relative_deadline, tp.period) < tp.exec_cost) /*density check*/
116 { 116 {
117 printk(KERN_INFO "litmus: real-time task %d rejected " 117 printk(KERN_INFO "litmus: real-time task %d rejected "
118 "because wcet greater than relative deadline\n", pid); 118 "because task density > 1.0\n", pid);
119 goto out_unlock; 119 goto out_unlock;
120 } 120 }
121 if (tp.cls != RT_CLASS_HARD && 121 if (tp.cls != RT_CLASS_HARD &&
@@ -325,12 +325,14 @@ long litmus_admit_task(struct task_struct* tsk)
325 325
326 BUG_ON(is_realtime(tsk)); 326 BUG_ON(is_realtime(tsk));
327 327
328 if (get_rt_rdeadline(tsk) == 0 || 328 if (get_rt_relative_deadline(tsk) == 0 ||
329 get_exec_cost(tsk) > get_rt_rdeadline(tsk)) { 329 get_exec_cost(tsk) >
330 min(get_rt_relative_deadline(tsk), get_period(tsk)) ) {
330 TRACE_TASK(tsk, 331 TRACE_TASK(tsk,
331 "litmus admit: invalid task parameters " 332 "litmus admit: invalid task parameters "
332 "(e = %lu, p = %lu, d = %lu)\n", 333 "(e = %lu, p = %lu, d = %lu)\n",
333 get_exec_cost(tsk), get_rt_period(tsk), get_rt_rdeadline(tsk)); 334 get_exec_cost(tsk), get_rt_period(tsk),
335 get_rt_relative_deadline(tsk));
334 retval = -EINVAL; 336 retval = -EINVAL;
335 goto out; 337 goto out;
336 } 338 }
diff --git a/litmus/rt_domain.c b/litmus/rt_domain.c
index d4db03ab5f95..d0b796611bea 100644
--- a/litmus/rt_domain.c
+++ b/litmus/rt_domain.c
@@ -300,9 +300,10 @@ void rt_domain_init(rt_domain_t *rt,
300 */ 300 */
301void __add_ready(rt_domain_t* rt, struct task_struct *new) 301void __add_ready(rt_domain_t* rt, struct task_struct *new)
302{ 302{
303 TRACE("rt: adding %s/%d (%llu, %llu, %llu) rel=%llu to ready queue at %llu\n", 303 TRACE("rt: adding %s/%d (%llu, %llu, %llu) rel=%llu "
304 "to ready queue at %llu\n",
304 new->comm, new->pid, 305 new->comm, new->pid,
305 get_exec_cost(new), get_rt_period(new), get_rt_rdeadline(new), 306 get_exec_cost(new), get_rt_period(new), get_rt_relative_deadline(new),
306 get_release(new), litmus_clock()); 307 get_release(new), litmus_clock());
307 308
308 BUG_ON(bheap_node_in_heap(tsk_rt(new)->heap_node)); 309 BUG_ON(bheap_node_in_heap(tsk_rt(new)->heap_node));
diff --git a/litmus/sched_pfair.c b/litmus/sched_pfair.c
index 6cf764ec26d4..72c06a492ef9 100644
--- a/litmus/sched_pfair.c
+++ b/litmus/sched_pfair.c
@@ -850,7 +850,7 @@ static long pfair_admit_task(struct task_struct* t)
850 cpu_cluster(pstate[task_cpu(t)])) 850 cpu_cluster(pstate[task_cpu(t)]))
851 return -EINVAL; 851 return -EINVAL;
852 852
853 if (get_rt_period(t) != get_rt_rdeadline(t)) { 853 if (get_rt_period(t) != get_rt_relative_deadline(t)) {
854 printk(KERN_INFO "%s: Admission rejected. " 854 printk(KERN_INFO "%s: Admission rejected. "
855 "Only implicit deadlines are currently supported.\n", 855 "Only implicit deadlines are currently supported.\n",
856 litmus->plugin_name); 856 litmus->plugin_name);