aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2009-05-03 20:02:53 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2009-05-03 20:02:53 -0400
commitfa940ad71184dec3d156b7dd673ee38067e7c0f6 (patch)
treed39c200ad6434867948ef6705bdbd16b7c397d27
parent68c699e1046646a9f03fea09049e9edc690995d0 (diff)
GQ-EDF: don't blindly overwrite entry->linked (bugfix)
Check if an already-linked task must be re-inserted into the ready queue.
-rw-r--r--litmus/sched_gq_edf.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/litmus/sched_gq_edf.c b/litmus/sched_gq_edf.c
index f27bf51341..e630fe926d 100644
--- a/litmus/sched_gq_edf.c
+++ b/litmus/sched_gq_edf.c
@@ -411,7 +411,7 @@ static void gq_finish_switch(struct task_struct *prev)
411static void gq_task_new(struct task_struct * t, int on_rq, int running) 411static void gq_task_new(struct task_struct * t, int on_rq, int running)
412{ 412{
413 unsigned long flags; 413 unsigned long flags;
414 cpu_state_t* entry; 414 cpu_state_t* entry = NULL;
415 int on_rm = 0; 415 int on_rm = 0;
416 416
417 spin_lock_irqsave(&gq_lock, flags); 417 spin_lock_irqsave(&gq_lock, flags);
@@ -434,9 +434,16 @@ static void gq_task_new(struct task_struct * t, int on_rq, int running)
434 if (running && !on_rm) { 434 if (running && !on_rm) {
435 /* just leave it where it is, CPU was real-time idle */ 435 /* just leave it where it is, CPU was real-time idle */
436 tsk_rt(t)->scheduled_on = task_cpu(t); 436 tsk_rt(t)->scheduled_on = task_cpu(t);
437 tsk_rt(t)->linked_on = task_cpu(t); 437 tsk_rt(t)->linked_on = task_cpu(t);
438 entry->linked = t;
439 entry->scheduled = t; 438 entry->scheduled = t;
439 if (entry->linked != NULL) {
440 /* Something raced and got assigned here.
441 * Kick it back into the queue, since t is
442 * already executing.
443 */
444 __add_ready(&gqedf, entry->linked);
445 }
446 entry->linked = t;
440 } 447 }
441 448
442 if (!running || on_rm) { 449 if (!running || on_rm) {