From 088ee7427d154649325badcdaa9e87fe57df13de Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Thu, 27 Jan 2011 15:57:55 -0500 Subject: Use hr_timer's active checks instead of having own flag. --- include/litmus/rt_param.h | 17 ++++++++--------- litmus/sched_edzl.c | 10 ++-------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index 53741727d5d0..63dc87b65551 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h @@ -82,14 +82,6 @@ struct rt_job { /* How much service has this job received so far? */ lt_t exec_time; -#ifdef CONFIG_PLUGIN_EDZL - /* boolean indicating zero-laxity state. We will - set this flag explicitly at zero-laxity detection. - This makes priority comparison operations more - predictable since laxity varies with time */ - int zero_laxity; -#endif - /* Which job is this. This is used to let user space * specify which job to wait for, which is important if jobs * overrun. If we just call sys_sleep_next_period() then we @@ -98,6 +90,14 @@ struct rt_job { * Increase this sequence number when a job is released. */ unsigned int job_no; + +#ifdef CONFIG_PLUGIN_EDZL + /* boolean indicating zero-laxity state. We will + set this flag explicitly at zero-laxity detection. + This makes priority comparison operations more + predictable since laxity varies with time */ + unsigned int zero_laxity:1; +#endif }; struct pfair_param; @@ -123,7 +123,6 @@ struct rt_param { struct rt_job job_params; #ifdef CONFIG_PLUGIN_EDZL - unsigned int zl_timer_armed:1; /* used to trigger zero-laxity detection */ struct hrtimer zl_timer; #endif diff --git a/litmus/sched_edzl.c b/litmus/sched_edzl.c index c0c8f848f00b..e9357c34561b 100644 --- a/litmus/sched_edzl.c +++ b/litmus/sched_edzl.c @@ -247,7 +247,6 @@ static enum hrtimer_restart on_zero_laxity(struct hrtimer *timer) get_deadline(t) - budget_remaining(t), get_deadline(t) - now); - tsk_rt(t)->zl_timer_armed = 0; set_zerolaxity(t); update_queue_position(t); @@ -265,14 +264,13 @@ static inline struct task_struct* __edzl_take_ready(rt_domain_t* rt) { if(get_zerolaxity(t) == 0) { - if(tsk_rt(t)->zl_timer_armed) + if(hrtimer_active(&tsk_rt(t)->zl_timer)) { int cancel_ret; TRACE_TASK(t, "Canceling zero-laxity timer.\n"); cancel_ret = hrtimer_try_to_cancel(&tsk_rt(t)->zl_timer); WARN_ON(cancel_ret == 0); /* should never be inactive. */ - tsk_rt(t)->zl_timer_armed = 0; } } else @@ -305,8 +303,6 @@ static inline void __edzl_add_ready(rt_domain_t* rt, struct task_struct *new) 0, HRTIMER_MODE_ABS_PINNED, 0); - - tsk_rt(new)->zl_timer_armed = 1; } else { @@ -662,7 +658,6 @@ static void edzl_task_new(struct task_struct * t, int on_rq, int running) raw_spin_lock_irqsave(&edzl_lock, flags); - t->rt_param.zl_timer_armed = 0; hrtimer_init(&t->rt_param.zl_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); t->rt_param.zl_timer.function = on_zero_laxity; @@ -754,12 +749,11 @@ static void edzl_task_exit(struct task_struct * t) tsk_rt(t)->scheduled_on = NO_CPU; } - if(tsk_rt(t)->zl_timer_armed) + if(hrtimer_active(&tsk_rt(t)->zl_timer)) { /* BUG if reached? */ TRACE_TASK(t, "Canceled armed timer while exiting.\n"); hrtimer_cancel(&tsk_rt(t)->zl_timer); - tsk_rt(t)->zl_timer_armed = 0; } raw_spin_unlock_irqrestore(&edzl_lock, flags); -- cgit v1.2.2