From 918fe97af91d4bee25b80fe058ae6ad333d2c86e Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Tue, 14 May 2013 10:13:29 -0400 Subject: don't save budgets on early completion --- litmus/sched_cedf.c | 42 ++++++++++++++++++++++++++---------------- litmus/sched_crm.c | 43 +++++++++++++++++++++++++++---------------- 2 files changed, 53 insertions(+), 32 deletions(-) diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c index 024470a7fb58..e9422077f9dd 100644 --- a/litmus/sched_cedf.c +++ b/litmus/sched_cedf.c @@ -576,7 +576,7 @@ static void cedf_release_jobs(rt_domain_t* rt, struct bheap* tasks) static noinline void job_completion(struct task_struct *t, int forced) { int do_release = 0; - int do_backlogged_job = 0; + int backlogged = 0; lt_t now; BUG_ON(!t); @@ -591,23 +591,25 @@ static noinline void job_completion(struct task_struct *t, int forced) if (!forced) { /* was it a backlogged job that completed? */ if (tsk_rt(t)->job_params.is_backlogged_job) { - BUG_ON(!get_backlog(t)); - --get_backlog(t); - TRACE_TASK(t, "completed backlogged job\n"); + if (get_backlog(t)) { + --get_backlog(t); + /* is_backlogged_job remains asserted */ + } + else { + /* caught up completely */ + TRACE_TASK(t, "completely caught up.\n"); + tsk_rt(t)->job_params.is_backlogged_job = 0; + /* we now look like a normally completing job. */ + } } } else { - /* budget was exhausted - force early release */ - if (get_backlog(t) == 0) { - TRACE_TASK(t, "first late job\n"); - ++get_backlog(t); - } ++get_backlog(t); TRACE_TASK(t, "adding backlogged job\n"); } - do_backlogged_job = has_backlog(t); + backlogged = has_backlog(t); TRACE_TASK(t, "number of backlogged jobs: %u\n", get_backlog(t)); } @@ -621,7 +623,8 @@ static noinline void job_completion(struct task_struct *t, int forced) /* set flags */ tsk_rt(t)->completed = 0; - if (unlikely(!forced && do_backlogged_job)) { +#if 0 + if (unlikely(!forced && backlogged)) { /* Don't advance deadline/refresh budget. Use the remaining budget for * the backlogged job. * @@ -629,28 +632,35 @@ static noinline void job_completion(struct task_struct *t, int forced) * blocking bound analysis. */ } + else if (unlikely(!forced && tsk_rt(t)->job_params.is_backlogged_job)) { + /* we've just about caught up, but we still have the job of this + * budget's allocation to do (even if it's for the future)... */ + TRACE_TASK(t, "Releasing final catch-up job.\n"); + backlogged = 1; + } else { +#endif cedf_untrack_in_top_m(t); prepare_for_next_period(t); do_release = (is_early_releasing(t) || is_released(t, now)); - if (do_backlogged_job) { + if (backlogged) { TRACE_TASK(t, "refreshing budget with early " "release for backlogged job.\n"); } - if (do_release || do_backlogged_job) { + if (do_release || backlogged) { /* log here to capture overheads */ sched_trace_task_release(t); } - } +// } unlink(t); /* release or arm next job */ if (is_running(t)) { /* is our next job a backlogged job? */ - if (do_backlogged_job) { + if (backlogged) { TRACE_TASK(t, "next job is a backlogged job.\n"); tsk_rt(t)->job_params.is_backlogged_job = 1; } @@ -659,7 +669,7 @@ static noinline void job_completion(struct task_struct *t, int forced) tsk_rt(t)->job_params.is_backlogged_job = 0; } - if (do_release || do_backlogged_job) { + if (do_release || backlogged) { cedf_track_in_top_m(t); cedf_job_arrival(t); } diff --git a/litmus/sched_crm.c b/litmus/sched_crm.c index a9721d6e09ae..b3f98f17ac0b 100644 --- a/litmus/sched_crm.c +++ b/litmus/sched_crm.c @@ -576,7 +576,7 @@ static void crm_release_jobs(rt_domain_t* rt, struct bheap* tasks) static noinline void job_completion(struct task_struct *t, int forced) { int do_release = 0; - int do_backlogged_job = 0; + int backlogged = 0; lt_t now; BUG_ON(!t); @@ -591,23 +591,25 @@ static noinline void job_completion(struct task_struct *t, int forced) if (!forced) { /* was it a backlogged job that completed? */ if (tsk_rt(t)->job_params.is_backlogged_job) { - BUG_ON(!get_backlog(t)); - --get_backlog(t); - TRACE_TASK(t, "completed backlogged job\n"); + if (get_backlog(t)) { + --get_backlog(t); + /* is_backlogged_job remains asserted */ + } + else { + /* caught up completely */ + TRACE_TASK(t, "completely caught up.\n"); + tsk_rt(t)->job_params.is_backlogged_job = 0; + /* we now look like a normally completing job. */ + } } } else { - /* budget was exhausted - force early release */ - if (get_backlog(t) == 0) { - TRACE_TASK(t, "first late job\n"); - ++get_backlog(t); - } ++get_backlog(t); TRACE_TASK(t, "adding backlogged job\n"); } - do_backlogged_job = has_backlog(t); + backlogged = has_backlog(t); TRACE_TASK(t, "number of backlogged jobs: %u\n", get_backlog(t)); } @@ -621,7 +623,8 @@ static noinline void job_completion(struct task_struct *t, int forced) /* set flags */ tsk_rt(t)->completed = 0; - if (unlikely(!forced && do_backlogged_job)) { +#if 0 + if (unlikely(!forced && backlogged)) { /* Don't advance deadline/refresh budget. Use the remaining budget for * the backlogged job. * @@ -629,28 +632,36 @@ static noinline void job_completion(struct task_struct *t, int forced) * blocking bound analysis. */ } + else if (unlikely(!forced && tsk_rt(t)->job_params.is_backlogged_job)) { + /* we've just about caught up, but we still have the job of this + * budget's allocation to do (even if it's for the future)... */ + TRACE_TASK(t, "Releasing final catch-up job.\n"); + backlogged = 1; + do_release = 1; + } else { +#endif crm_untrack_in_top_m(t); prepare_for_next_period(t); do_release = (is_early_releasing(t) || is_released(t, now)); - if (do_backlogged_job) { + if (backlogged) { TRACE_TASK(t, "refreshing budget with early " "release for backlogged job.\n"); } - if (do_release || do_backlogged_job) { + if (do_release || backlogged) { /* log here to capture overheads */ sched_trace_task_release(t); } - } +// } unlink(t); /* release or arm next job */ if (is_running(t)) { /* is our next job a backlogged job? */ - if (do_backlogged_job) { + if (backlogged) { TRACE_TASK(t, "next job is a backlogged job.\n"); tsk_rt(t)->job_params.is_backlogged_job = 1; } @@ -659,7 +670,7 @@ static noinline void job_completion(struct task_struct *t, int forced) tsk_rt(t)->job_params.is_backlogged_job = 0; } - if (do_release || do_backlogged_job) { + if (do_release || backlogged) { crm_track_in_top_m(t); crm_job_arrival(t); } -- cgit v1.2.2