aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-05-04 18:13:45 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-05-04 18:13:45 -0400
commit6d05093e061460dab8c3f8e517fb9906c9abe669 (patch)
tree1c2560dfabaa2e1049c2406fc372ebc164780c1a
parent6b06d1ce233787655eb21b624ed924806768b36c (diff)
EDF: don't arm timers multiple times
Blocking and preemptions must take precedence over forced job completions.
-rw-r--r--litmus/sched_gsn_edf.c18
-rw-r--r--litmus/sched_psn_edf.c5
2 files changed, 14 insertions, 9 deletions
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c
index eb0f4c0b36..854dfcf141 100644
--- a/litmus/sched_gsn_edf.c
+++ b/litmus/sched_gsn_edf.c
@@ -435,9 +435,10 @@ static struct task_struct* gsnedf_schedule(struct task_struct * prev)
435 435
436 /* Any task that is preemptable and either exhausts its execution 436 /* Any task that is preemptable and either exhausts its execution
437 * budget or wants to sleep completes. We may have to reschedule after 437 * budget or wants to sleep completes. We may have to reschedule after
438 * this. 438 * this. Don't do a job completion if we block (can't have timers running
439 * for blocked jobs). Preemption go first for the same reason.
439 */ 440 */
440 if (!np && (out_of_time || sleep)) 441 if (!np && (out_of_time || sleep) && !blocks && !preempt)
441 job_completion(entry->scheduled); 442 job_completion(entry->scheduled);
442 443
443 /* Link pending task if we became unlinked. 444 /* Link pending task if we became unlinked.
@@ -446,15 +447,22 @@ static struct task_struct* gsnedf_schedule(struct task_struct * prev)
446 link_task_to_cpu(__take_ready(&gsnedf), entry); 447 link_task_to_cpu(__take_ready(&gsnedf), entry);
447 448
448 /* The final scheduling decision. Do we need to switch for some reason? 449 /* The final scheduling decision. Do we need to switch for some reason?
449 * If linked different from scheduled select linked as next. 450 * If linked is different from scheduled, then select linked as next.
450 */ 451 */
451 if ((!np || blocks) && 452 if ((!np || blocks) &&
452 entry->linked != entry->scheduled) { 453 entry->linked != entry->scheduled) {
453 /* Schedule a linked job? */ 454 /* Schedule a linked job? */
454 if (entry->linked) 455 if (entry->linked) {
456 entry->linked->rt_param.scheduled_on = entry->cpu;
455 next = entry->linked; 457 next = entry->linked;
458 }
459 if (entry->scheduled) {
460 /* not gonna be scheduled soon */
461 entry->scheduled->rt_param.scheduled_on = NO_CPU;
462 TRACE_TASK(entry->scheduled, "scheduled_on = NO_CPU\n");
463 }
456 } else 464 } else
457 /* Only override Linux scheduler if we have real-time task 465 /* Only override Linux scheduler if we have a real-time task
458 * scheduled that needs to continue. 466 * scheduled that needs to continue.
459 */ 467 */
460 if (exists) 468 if (exists)
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c
index cc7b09108f..55c55862d1 100644
--- a/litmus/sched_psn_edf.c
+++ b/litmus/sched_psn_edf.c
@@ -57,9 +57,6 @@ static void psnedf_domain_init(psnedf_domain_t* pedf,
57 57
58static void requeue(struct task_struct* t, rt_domain_t *edf) 58static void requeue(struct task_struct* t, rt_domain_t *edf)
59{ 59{
60 /* only requeue if t is actually running */
61 BUG_ON(!is_running(t));
62
63 if (t->state != TASK_RUNNING) 60 if (t->state != TASK_RUNNING)
64 TRACE_TASK(t, "requeue: !TASK_RUNNING"); 61 TRACE_TASK(t, "requeue: !TASK_RUNNING");
65 62
@@ -176,7 +173,7 @@ static struct task_struct* psnedf_schedule(struct task_struct * prev)
176 * budget or wants to sleep completes. We may have to reschedule after 173 * budget or wants to sleep completes. We may have to reschedule after
177 * this. 174 * this.
178 */ 175 */
179 if (!np && (out_of_time || sleep)) { 176 if (!np && (out_of_time || sleep) && !blocks) {
180 job_completion(pedf->scheduled); 177 job_completion(pedf->scheduled);
181 resched = 1; 178 resched = 1;
182 } 179 }