diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-01-28 09:42:15 -0500 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-01-28 09:42:15 -0500 |
commit | 0ee906925fbca18a3dc76a2e42e710d0f1fbd721 (patch) | |
tree | 3859effd2c664262191d652159f24bc8368cc655 /litmus | |
parent | dd2312f257e3ed4580881db1a466fbd4386e6117 (diff) |
Fix BUG: enter gsnedf_schedule with entry->scheduled = NULL
This solves (? -- or at least solve one of the possible reasons for ;)
a BUG in sched_gsnedf where a real-time task could enter gsnedf_schedule
with an entry->schedule = NULL (and this is BAD!)
Diffstat (limited to 'litmus')
-rw-r--r-- | litmus/sched_gsn_edf.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c index 9f256be86cf7..98c3c4bc3128 100644 --- a/litmus/sched_gsn_edf.c +++ b/litmus/sched_gsn_edf.c | |||
@@ -469,7 +469,7 @@ static struct task_struct* gsnedf_schedule(struct task_struct * prev) | |||
469 | if (entry->scheduled) { | 469 | if (entry->scheduled) { |
470 | /* not gonna be scheduled soon */ | 470 | /* not gonna be scheduled soon */ |
471 | entry->scheduled->rt_param.scheduled_on = NO_CPU; | 471 | entry->scheduled->rt_param.scheduled_on = NO_CPU; |
472 | TRACE_TASK(entry->scheduled, "scheduled_on = NO_CPU\n"); | 472 | TRACE_TASK(entry->scheduled, "gsnedf_schedule: scheduled_on = NO_CPU\n"); |
473 | } | 473 | } |
474 | } else | 474 | } else |
475 | /* Only override Linux scheduler if we have a real-time task | 475 | /* Only override Linux scheduler if we have a real-time task |
@@ -578,8 +578,18 @@ static void gsnedf_task_block(struct task_struct *t) | |||
578 | 578 | ||
579 | TRACE_TASK(t, "block at %llu\n", litmus_clock()); | 579 | TRACE_TASK(t, "block at %llu\n", litmus_clock()); |
580 | 580 | ||
581 | |||
581 | /* unlink if necessary */ | 582 | /* unlink if necessary */ |
582 | spin_lock_irqsave(&gsnedf_lock, flags); | 583 | spin_lock_irqsave(&gsnedf_lock, flags); |
584 | |||
585 | /* this is tricky: is gonna be unlinked _and_ rescheduled | ||
586 | * but if rescheduling decision is deferred scheduled_on | ||
587 | * will remain to current cpu and this may cause entry->scheduled | ||
588 | * (of some other task) to be rewritten | ||
589 | */ | ||
590 | t->rt_param.scheduled_on = NO_CPU; | ||
591 | TRACE_TASK(t, "gsnedf_task_block: scheduled_on = NO_CPU\n"); | ||
592 | |||
583 | unlink(t); | 593 | unlink(t); |
584 | spin_unlock_irqrestore(&gsnedf_lock, flags); | 594 | spin_unlock_irqrestore(&gsnedf_lock, flags); |
585 | 595 | ||