diff options
Diffstat (limited to 'litmus/budget.c')
-rw-r--r-- | litmus/budget.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/litmus/budget.c b/litmus/budget.c index 75f4b5156947..7d94f7e61b27 100644 --- a/litmus/budget.c +++ b/litmus/budget.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <litmus/litmus.h> | 5 | #include <litmus/litmus.h> |
6 | #include <litmus/preempt.h> | 6 | #include <litmus/preempt.h> |
7 | #include <litmus/budget.h> | 7 | #include <litmus/budget.h> |
8 | #include <litmus/sched_trace.h> | ||
8 | 9 | ||
9 | struct enforcement_timer { | 10 | struct enforcement_timer { |
10 | /* The enforcement timer is used to accurately police | 11 | /* The enforcement timer is used to accurately police |
@@ -63,7 +64,7 @@ static void arm_enforcement_timer(struct enforcement_timer* et, | |||
63 | 64 | ||
64 | /* Calling this when there is no budget left for the task | 65 | /* Calling this when there is no budget left for the task |
65 | * makes no sense, unless the task is non-preemptive. */ | 66 | * makes no sense, unless the task is non-preemptive. */ |
66 | BUG_ON(budget_exhausted(t) && (!is_np(t))); | 67 | /* BUG_ON(budget_exhausted(t) && (!is_np(t))); */ |
67 | 68 | ||
68 | /* __hrtimer_start_range_ns() cancels the timer | 69 | /* __hrtimer_start_range_ns() cancels the timer |
69 | * anyway, so we don't have to check whether it is still armed */ | 70 | * anyway, so we don't have to check whether it is still armed */ |
@@ -109,20 +110,38 @@ static int __init init_budget_enforcement(void) | |||
109 | return 0; | 110 | return 0; |
110 | } | 111 | } |
111 | 112 | ||
113 | void task_release(struct task_struct *t) | ||
114 | { | ||
115 | t->rt_param.job_params.real_release = t->rt_param.job_params.deadline; | ||
116 | t->rt_param.job_params.real_deadline += get_rt_period(t); | ||
117 | t->rt_param.job_params.job_no++; | ||
118 | TRACE_TASK(t, "Releasing task, rr=%llu rd=%llu\n", | ||
119 | t->rt_param.job_params.real_release, | ||
120 | t->rt_param.job_params.real_deadline); | ||
121 | sched_trace_task_release(t); | ||
122 | } | ||
123 | |||
124 | void server_release(struct task_struct *t) | ||
125 | { | ||
126 | lt_t now = litmus_clock(); | ||
127 | t->rt_param.job_params.exec_time = 0; | ||
128 | t->rt_param.job_params.release = t->rt_param.job_params.deadline; | ||
129 | t->rt_param.job_params.deadline += get_rt_period(t); | ||
130 | TRACE_TASK(t, "Releasing server, r=%llu d=%llu\n", | ||
131 | t->rt_param.job_params.release, | ||
132 | t->rt_param.job_params.deadline); | ||
133 | /* don't confuse linux */ | ||
134 | t->rt.time_slice = 1; | ||
135 | } | ||
136 | |||
112 | void prepare_for_next_server(struct task_struct *t, int forced) | 137 | void prepare_for_next_server(struct task_struct *t, int forced) |
113 | { | 138 | { |
114 | if (!job_behind(t)) { | 139 | if (forced || job_behind(t)) { |
115 | t->rt_param.job_params.release = t->rt_param.job_params.deadline; | 140 | server_release(t); |
116 | t->rt_param.job_params.deadline += get_rt_period(t); | 141 | } |
117 | t->rt_param.job_params.exec_time = 0; | 142 | |
118 | /* update job sequence number */ | 143 | if (!forced) { |
119 | t->rt_param.job_params.job_no++; | 144 | task_release(t); |
120 | } else if (forced) { | ||
121 | t->rt_param.job_params.release = t->rt_param.job_params.deadline; | ||
122 | t->rt_param.job_params.exec_time = 0; | ||
123 | } else /* behind */{ | ||
124 | t->rt_param.job_params.deadline += get_rt_period(t); | ||
125 | t->rt_param.job_params.job_no++; | ||
126 | } | 145 | } |
127 | } | 146 | } |
128 | 147 | ||