From 6d05093e061460dab8c3f8e517fb9906c9abe669 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Sun, 4 May 2008 18:13:45 -0400 Subject: EDF: don't arm timers multiple times Blocking and preemptions must take precedence over forced job completions. --- litmus/sched_gsn_edf.c | 18 +++++++++++++----- litmus/sched_psn_edf.c | 5 +---- 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) /* Any task that is preemptable and either exhausts its execution * budget or wants to sleep completes. We may have to reschedule after - * this. + * this. Don't do a job completion if we block (can't have timers running + * for blocked jobs). Preemption go first for the same reason. */ - if (!np && (out_of_time || sleep)) + if (!np && (out_of_time || sleep) && !blocks && !preempt) job_completion(entry->scheduled); /* Link pending task if we became unlinked. @@ -446,15 +447,22 @@ static struct task_struct* gsnedf_schedule(struct task_struct * prev) link_task_to_cpu(__take_ready(&gsnedf), entry); /* The final scheduling decision. Do we need to switch for some reason? - * If linked different from scheduled select linked as next. + * If linked is different from scheduled, then select linked as next. */ if ((!np || blocks) && entry->linked != entry->scheduled) { /* Schedule a linked job? */ - if (entry->linked) + if (entry->linked) { + entry->linked->rt_param.scheduled_on = entry->cpu; next = entry->linked; + } + if (entry->scheduled) { + /* not gonna be scheduled soon */ + entry->scheduled->rt_param.scheduled_on = NO_CPU; + TRACE_TASK(entry->scheduled, "scheduled_on = NO_CPU\n"); + } } else - /* Only override Linux scheduler if we have real-time task + /* Only override Linux scheduler if we have a real-time task * scheduled that needs to continue. */ 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, static void requeue(struct task_struct* t, rt_domain_t *edf) { - /* only requeue if t is actually running */ - BUG_ON(!is_running(t)); - if (t->state != TASK_RUNNING) TRACE_TASK(t, "requeue: !TASK_RUNNING"); @@ -176,7 +173,7 @@ static struct task_struct* psnedf_schedule(struct task_struct * prev) * budget or wants to sleep completes. We may have to reschedule after * this. */ - if (!np && (out_of_time || sleep)) { + if (!np && (out_of_time || sleep) && !blocks) { job_completion(pedf->scheduled); resched = 1; } -- cgit v1.2.2