aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_psn_edf.c
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-06-08 16:11:41 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-06-08 16:11:41 -0400
commit78ae3306ff8b63a4592044aa28c2f2cbc1d36b20 (patch)
tree05af7f7b7a762f8d5fea95adbdec83b1d406dd24 /litmus/sched_psn_edf.c
parent39d902832855cbd2baf45ac8943879be3ad8ca5a (diff)
PSN-EDF: fix admission of suspended task
The PSN-EDF plugin used to crash when trying to admit a suspended task. This patch fixes the task_new() handler to tolerate this case.
Diffstat (limited to 'litmus/sched_psn_edf.c')
-rw-r--r--litmus/sched_psn_edf.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c
index 65c85a3a4c64..4c3ee8f68bc1 100644
--- a/litmus/sched_psn_edf.c
+++ b/litmus/sched_psn_edf.c
@@ -281,7 +281,7 @@ static struct task_struct* psnedf_schedule(struct task_struct * prev)
281 281
282/* Prepare a task for running in RT mode 282/* Prepare a task for running in RT mode
283 */ 283 */
284static void psnedf_task_new(struct task_struct * t, int on_rq, int running) 284static void psnedf_task_new(struct task_struct * t, int on_rq, int is_scheduled)
285{ 285{
286 rt_domain_t* edf = task_edf(t); 286 rt_domain_t* edf = task_edf(t);
287 psnedf_domain_t* pedf = task_pedf(t); 287 psnedf_domain_t* pedf = task_pedf(t);
@@ -297,14 +297,21 @@ static void psnedf_task_new(struct task_struct * t, int on_rq, int running)
297 * code will try to wake it up with fatal consequences. 297 * code will try to wake it up with fatal consequences.
298 */ 298 */
299 raw_spin_lock_irqsave(&pedf->slock, flags); 299 raw_spin_lock_irqsave(&pedf->slock, flags);
300 if (running) { 300 if (is_scheduled) {
301 /* there shouldn't be anything else running at the time */ 301 /* there shouldn't be anything else scheduled at the time */
302 BUG_ON(pedf->scheduled); 302 BUG_ON(pedf->scheduled);
303 pedf->scheduled = t; 303 pedf->scheduled = t;
304 } else { 304 } else {
305 requeue(t, edf); 305 /* !is_scheduled means it is not scheduled right now, but it
306 /* maybe we have to reschedule */ 306 * does not mean that it is suspended. If it is not suspended,
307 psnedf_preempt_check(pedf); 307 * it still needs to be requeued. If it is suspended, there is
308 * nothing that we need to do as it will be handled by the
309 * wake_up() handler. */
310 if (is_running(t)) {
311 requeue(t, edf);
312 /* maybe we have to reschedule */
313 psnedf_preempt_check(pedf);
314 }
308 } 315 }
309 raw_spin_unlock_irqrestore(&pedf->slock, flags); 316 raw_spin_unlock_irqrestore(&pedf->slock, flags);
310} 317}