From 1c5a2a2cf3b7c99715fffc96cd80bfb03aef6648 Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Tue, 17 Jul 2012 17:23:12 -0400 Subject: Revisions based on review comments. * Simplified jobs.c. * Fixed bug in density admissions check. * Renamed rdeadline to be relative_deadline. --- litmus/jobs.c | 29 +++++++++++------------------ litmus/litmus.c | 16 +++++++++------- litmus/rt_domain.c | 5 +++-- litmus/sched_pfair.c | 2 +- 4 files changed, 24 insertions(+), 28 deletions(-) (limited to 'litmus') 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 @@ #include #include - -void prepare_for_next_period(struct task_struct *t) +static inline void setup_release(struct task_struct *t, lt_t release) { - BUG_ON(!t); /* prepare next release */ - t->rt_param.job_params.release += get_rt_period(t); - t->rt_param.job_params.deadline = t->rt_param.job_params.release - + get_rt_rdeadline(t); + t->rt_param.job_params.release = release; + t->rt_param.job_params.deadline = release + get_rt_relative_deadline(t); t->rt_param.job_params.exec_time = 0; + /* update job sequence number */ t->rt_param.job_params.job_no++; @@ -22,21 +20,16 @@ void prepare_for_next_period(struct task_struct *t) t->rt.time_slice = 1; } -void release_at(struct task_struct *t, lt_t start) +void prepare_for_next_period(struct task_struct *t) { BUG_ON(!t); + setup_release(t, get_release(t) + get_rt_period(t)); +} - /* prepare next release */ - t->rt_param.job_params.release = start; - t->rt_param.job_params.deadline = start + get_rt_rdeadline(t); - t->rt_param.job_params.exec_time = 0; - - /* update job sequence number */ - t->rt_param.job_params.job_no++; - - /* don't confuse Linux */ - t->rt.time_slice = 1; - +void release_at(struct task_struct *t, lt_t start) +{ + BUG_ON(!t); + setup_release(t, start); set_rt_flags(t, RT_F_RUNNING); } 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) } /* set relative deadline to be implicit if left unspecified */ - if (tp.rdeadline == 0) - tp.rdeadline = tp.period; + if (tp.relative_deadline == 0) + tp.relative_deadline = tp.period; if (tp.exec_cost <= 0) goto out_unlock; @@ -112,10 +112,10 @@ asmlinkage long sys_set_rt_task_param(pid_t pid, struct rt_task __user * param) goto out_unlock; if (!cpu_online(tp.cpu)) goto out_unlock; - if (tp.rdeadline < tp.exec_cost) + if (min(tp.relative_deadline, tp.period) < tp.exec_cost) /*density check*/ { printk(KERN_INFO "litmus: real-time task %d rejected " - "because wcet greater than relative deadline\n", pid); + "because task density > 1.0\n", pid); goto out_unlock; } if (tp.cls != RT_CLASS_HARD && @@ -325,12 +325,14 @@ long litmus_admit_task(struct task_struct* tsk) BUG_ON(is_realtime(tsk)); - if (get_rt_rdeadline(tsk) == 0 || - get_exec_cost(tsk) > get_rt_rdeadline(tsk)) { + if (get_rt_relative_deadline(tsk) == 0 || + get_exec_cost(tsk) > + min(get_rt_relative_deadline(tsk), get_period(tsk)) ) { TRACE_TASK(tsk, "litmus admit: invalid task parameters " "(e = %lu, p = %lu, d = %lu)\n", - get_exec_cost(tsk), get_rt_period(tsk), get_rt_rdeadline(tsk)); + get_exec_cost(tsk), get_rt_period(tsk), + get_rt_relative_deadline(tsk)); retval = -EINVAL; goto out; } 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, */ void __add_ready(rt_domain_t* rt, struct task_struct *new) { - TRACE("rt: adding %s/%d (%llu, %llu, %llu) rel=%llu to ready queue at %llu\n", + TRACE("rt: adding %s/%d (%llu, %llu, %llu) rel=%llu " + "to ready queue at %llu\n", new->comm, new->pid, - get_exec_cost(new), get_rt_period(new), get_rt_rdeadline(new), + get_exec_cost(new), get_rt_period(new), get_rt_relative_deadline(new), get_release(new), litmus_clock()); 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) cpu_cluster(pstate[task_cpu(t)])) return -EINVAL; - if (get_rt_period(t) != get_rt_rdeadline(t)) { + if (get_rt_period(t) != get_rt_relative_deadline(t)) { printk(KERN_INFO "%s: Admission rejected. " "Only implicit deadlines are currently supported.\n", litmus->plugin_name); -- cgit v1.2.2