diff options
Diffstat (limited to 'litmus/sched_psn_edf.c')
-rw-r--r-- | litmus/sched_psn_edf.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c index 0e1675d2e572..63fa6103882a 100644 --- a/litmus/sched_psn_edf.c +++ b/litmus/sched_psn_edf.c | |||
@@ -174,17 +174,25 @@ static void psnedf_tick(struct task_struct *t) | |||
174 | */ | 174 | */ |
175 | BUG_ON(is_realtime(t) && t != pedf->scheduled); | 175 | BUG_ON(is_realtime(t) && t != pedf->scheduled); |
176 | 176 | ||
177 | if (is_realtime(t) && budget_enforced(t) && budget_exhausted(t)) { | 177 | if (is_realtime(t) && budget_exhausted(t)) |
178 | if (!is_np(t)) { | 178 | { |
179 | litmus_reschedule_local(); | 179 | if (budget_signalled(t) && !sigbudget_sent(t)) { |
180 | TRACE("psnedf_scheduler_tick: " | 180 | /* signal exhaustion */ |
181 | "%d is preemptable " | 181 | send_sigbudget(t); |
182 | " => FORCE_RESCHED\n", t->pid); | 182 | } |
183 | } else if (is_user_np(t)) { | 183 | |
184 | TRACE("psnedf_scheduler_tick: " | 184 | if (budget_enforced(t)) { |
185 | "%d is non-preemptable, " | 185 | if (!is_np(t)) { |
186 | "preemption delayed.\n", t->pid); | 186 | litmus_reschedule_local(); |
187 | request_exit_np(t); | 187 | TRACE("psnedf_scheduler_tick: " |
188 | "%d is preemptable " | ||
189 | " => FORCE_RESCHED\n", t->pid); | ||
190 | } else if (is_user_np(t)) { | ||
191 | TRACE("psnedf_scheduler_tick: " | ||
192 | "%d is non-preemptable, " | ||
193 | "preemption delayed.\n", t->pid); | ||
194 | request_exit_np(t); | ||
195 | } | ||
188 | } | 196 | } |
189 | } | 197 | } |
190 | } | 198 | } |
@@ -195,8 +203,7 @@ static struct task_struct* psnedf_schedule(struct task_struct * prev) | |||
195 | rt_domain_t* edf = &pedf->domain; | 203 | rt_domain_t* edf = &pedf->domain; |
196 | struct task_struct* next; | 204 | struct task_struct* next; |
197 | 205 | ||
198 | int out_of_time, sleep, preempt, | 206 | int out_of_time, signal_budget, sleep, preempt, np, exists, blocks, resched; |
199 | np, exists, blocks, resched; | ||
200 | 207 | ||
201 | raw_spin_lock(&pedf->slock); | 208 | raw_spin_lock(&pedf->slock); |
202 | 209 | ||
@@ -213,6 +220,10 @@ static struct task_struct* psnedf_schedule(struct task_struct * prev) | |||
213 | out_of_time = exists && | 220 | out_of_time = exists && |
214 | budget_enforced(pedf->scheduled) && | 221 | budget_enforced(pedf->scheduled) && |
215 | budget_exhausted(pedf->scheduled); | 222 | budget_exhausted(pedf->scheduled); |
223 | signal_budget = exists && | ||
224 | budget_signalled(pedf->scheduled) && | ||
225 | budget_exhausted(pedf->scheduled) && | ||
226 | !sigbudget_sent(pedf->scheduled); | ||
216 | np = exists && is_np(pedf->scheduled); | 227 | np = exists && is_np(pedf->scheduled); |
217 | sleep = exists && is_completed(pedf->scheduled); | 228 | sleep = exists && is_completed(pedf->scheduled); |
218 | preempt = edf_preemption_needed(edf, prev); | 229 | preempt = edf_preemption_needed(edf, prev); |
@@ -223,6 +234,10 @@ static struct task_struct* psnedf_schedule(struct task_struct * prev) | |||
223 | */ | 234 | */ |
224 | resched = preempt; | 235 | resched = preempt; |
225 | 236 | ||
237 | /* Send the signal that the budget has been exhausted */ | ||
238 | if (signal_budget) | ||
239 | send_sigbudget(pedf->scheduled); | ||
240 | |||
226 | /* If a task blocks we have no choice but to reschedule. | 241 | /* If a task blocks we have no choice but to reschedule. |
227 | */ | 242 | */ |
228 | if (blocks) | 243 | if (blocks) |