diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-05-14 10:13:29 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-05-14 10:13:29 -0400 |
commit | 918fe97af91d4bee25b80fe058ae6ad333d2c86e (patch) | |
tree | 1c8d11f25fad021684a9b8c28b51cc33621793e8 | |
parent | 188b47794737059a20b79803f448f4dc4cd09398 (diff) |
don't save budgets on early completion
-rw-r--r-- | litmus/sched_cedf.c | 42 | ||||
-rw-r--r-- | 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) | |||
576 | static noinline void job_completion(struct task_struct *t, int forced) | 576 | static noinline void job_completion(struct task_struct *t, int forced) |
577 | { | 577 | { |
578 | int do_release = 0; | 578 | int do_release = 0; |
579 | int do_backlogged_job = 0; | 579 | int backlogged = 0; |
580 | lt_t now; | 580 | lt_t now; |
581 | 581 | ||
582 | BUG_ON(!t); | 582 | BUG_ON(!t); |
@@ -591,23 +591,25 @@ static noinline void job_completion(struct task_struct *t, int forced) | |||
591 | if (!forced) { | 591 | if (!forced) { |
592 | /* was it a backlogged job that completed? */ | 592 | /* was it a backlogged job that completed? */ |
593 | if (tsk_rt(t)->job_params.is_backlogged_job) { | 593 | if (tsk_rt(t)->job_params.is_backlogged_job) { |
594 | BUG_ON(!get_backlog(t)); | ||
595 | --get_backlog(t); | ||
596 | |||
597 | TRACE_TASK(t, "completed backlogged job\n"); | 594 | TRACE_TASK(t, "completed backlogged job\n"); |
595 | if (get_backlog(t)) { | ||
596 | --get_backlog(t); | ||
597 | /* is_backlogged_job remains asserted */ | ||
598 | } | ||
599 | else { | ||
600 | /* caught up completely */ | ||
601 | TRACE_TASK(t, "completely caught up.\n"); | ||
602 | tsk_rt(t)->job_params.is_backlogged_job = 0; | ||
603 | /* we now look like a normally completing job. */ | ||
604 | } | ||
598 | } | 605 | } |
599 | } | 606 | } |
600 | else { | 607 | else { |
601 | /* budget was exhausted - force early release */ | ||
602 | if (get_backlog(t) == 0) { | ||
603 | TRACE_TASK(t, "first late job\n"); | ||
604 | ++get_backlog(t); | ||
605 | } | ||
606 | ++get_backlog(t); | 608 | ++get_backlog(t); |
607 | TRACE_TASK(t, "adding backlogged job\n"); | 609 | TRACE_TASK(t, "adding backlogged job\n"); |
608 | } | 610 | } |
609 | 611 | ||
610 | do_backlogged_job = has_backlog(t); | 612 | backlogged = has_backlog(t); |
611 | TRACE_TASK(t, "number of backlogged jobs: %u\n", | 613 | TRACE_TASK(t, "number of backlogged jobs: %u\n", |
612 | get_backlog(t)); | 614 | get_backlog(t)); |
613 | } | 615 | } |
@@ -621,7 +623,8 @@ static noinline void job_completion(struct task_struct *t, int forced) | |||
621 | /* set flags */ | 623 | /* set flags */ |
622 | tsk_rt(t)->completed = 0; | 624 | tsk_rt(t)->completed = 0; |
623 | 625 | ||
624 | if (unlikely(!forced && do_backlogged_job)) { | 626 | #if 0 |
627 | if (unlikely(!forced && backlogged)) { | ||
625 | /* Don't advance deadline/refresh budget. Use the remaining budget for | 628 | /* Don't advance deadline/refresh budget. Use the remaining budget for |
626 | * the backlogged job. | 629 | * the backlogged job. |
627 | * | 630 | * |
@@ -629,28 +632,35 @@ static noinline void job_completion(struct task_struct *t, int forced) | |||
629 | * blocking bound analysis. | 632 | * blocking bound analysis. |
630 | */ | 633 | */ |
631 | } | 634 | } |
635 | else if (unlikely(!forced && tsk_rt(t)->job_params.is_backlogged_job)) { | ||
636 | /* we've just about caught up, but we still have the job of this | ||
637 | * budget's allocation to do (even if it's for the future)... */ | ||
638 | TRACE_TASK(t, "Releasing final catch-up job.\n"); | ||
639 | backlogged = 1; | ||
640 | } | ||
632 | else { | 641 | else { |
642 | #endif | ||
633 | cedf_untrack_in_top_m(t); | 643 | cedf_untrack_in_top_m(t); |
634 | prepare_for_next_period(t); | 644 | prepare_for_next_period(t); |
635 | 645 | ||
636 | do_release = (is_early_releasing(t) || is_released(t, now)); | 646 | do_release = (is_early_releasing(t) || is_released(t, now)); |
637 | 647 | ||
638 | if (do_backlogged_job) { | 648 | if (backlogged) { |
639 | TRACE_TASK(t, "refreshing budget with early " | 649 | TRACE_TASK(t, "refreshing budget with early " |
640 | "release for backlogged job.\n"); | 650 | "release for backlogged job.\n"); |
641 | } | 651 | } |
642 | if (do_release || do_backlogged_job) { | 652 | if (do_release || backlogged) { |
643 | /* log here to capture overheads */ | 653 | /* log here to capture overheads */ |
644 | sched_trace_task_release(t); | 654 | sched_trace_task_release(t); |
645 | } | 655 | } |
646 | } | 656 | // } |
647 | 657 | ||
648 | unlink(t); | 658 | unlink(t); |
649 | 659 | ||
650 | /* release or arm next job */ | 660 | /* release or arm next job */ |
651 | if (is_running(t)) { | 661 | if (is_running(t)) { |
652 | /* is our next job a backlogged job? */ | 662 | /* is our next job a backlogged job? */ |
653 | if (do_backlogged_job) { | 663 | if (backlogged) { |
654 | TRACE_TASK(t, "next job is a backlogged job.\n"); | 664 | TRACE_TASK(t, "next job is a backlogged job.\n"); |
655 | tsk_rt(t)->job_params.is_backlogged_job = 1; | 665 | tsk_rt(t)->job_params.is_backlogged_job = 1; |
656 | } | 666 | } |
@@ -659,7 +669,7 @@ static noinline void job_completion(struct task_struct *t, int forced) | |||
659 | tsk_rt(t)->job_params.is_backlogged_job = 0; | 669 | tsk_rt(t)->job_params.is_backlogged_job = 0; |
660 | } | 670 | } |
661 | 671 | ||
662 | if (do_release || do_backlogged_job) { | 672 | if (do_release || backlogged) { |
663 | cedf_track_in_top_m(t); | 673 | cedf_track_in_top_m(t); |
664 | cedf_job_arrival(t); | 674 | cedf_job_arrival(t); |
665 | } | 675 | } |
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) | |||
576 | static noinline void job_completion(struct task_struct *t, int forced) | 576 | static noinline void job_completion(struct task_struct *t, int forced) |
577 | { | 577 | { |
578 | int do_release = 0; | 578 | int do_release = 0; |
579 | int do_backlogged_job = 0; | 579 | int backlogged = 0; |
580 | lt_t now; | 580 | lt_t now; |
581 | 581 | ||
582 | BUG_ON(!t); | 582 | BUG_ON(!t); |
@@ -591,23 +591,25 @@ static noinline void job_completion(struct task_struct *t, int forced) | |||
591 | if (!forced) { | 591 | if (!forced) { |
592 | /* was it a backlogged job that completed? */ | 592 | /* was it a backlogged job that completed? */ |
593 | if (tsk_rt(t)->job_params.is_backlogged_job) { | 593 | if (tsk_rt(t)->job_params.is_backlogged_job) { |
594 | BUG_ON(!get_backlog(t)); | ||
595 | --get_backlog(t); | ||
596 | |||
597 | TRACE_TASK(t, "completed backlogged job\n"); | 594 | TRACE_TASK(t, "completed backlogged job\n"); |
595 | if (get_backlog(t)) { | ||
596 | --get_backlog(t); | ||
597 | /* is_backlogged_job remains asserted */ | ||
598 | } | ||
599 | else { | ||
600 | /* caught up completely */ | ||
601 | TRACE_TASK(t, "completely caught up.\n"); | ||
602 | tsk_rt(t)->job_params.is_backlogged_job = 0; | ||
603 | /* we now look like a normally completing job. */ | ||
604 | } | ||
598 | } | 605 | } |
599 | } | 606 | } |
600 | else { | 607 | else { |
601 | /* budget was exhausted - force early release */ | ||
602 | if (get_backlog(t) == 0) { | ||
603 | TRACE_TASK(t, "first late job\n"); | ||
604 | ++get_backlog(t); | ||
605 | } | ||
606 | ++get_backlog(t); | 608 | ++get_backlog(t); |
607 | TRACE_TASK(t, "adding backlogged job\n"); | 609 | TRACE_TASK(t, "adding backlogged job\n"); |
608 | } | 610 | } |
609 | 611 | ||
610 | do_backlogged_job = has_backlog(t); | 612 | backlogged = has_backlog(t); |
611 | TRACE_TASK(t, "number of backlogged jobs: %u\n", | 613 | TRACE_TASK(t, "number of backlogged jobs: %u\n", |
612 | get_backlog(t)); | 614 | get_backlog(t)); |
613 | } | 615 | } |
@@ -621,7 +623,8 @@ static noinline void job_completion(struct task_struct *t, int forced) | |||
621 | /* set flags */ | 623 | /* set flags */ |
622 | tsk_rt(t)->completed = 0; | 624 | tsk_rt(t)->completed = 0; |
623 | 625 | ||
624 | if (unlikely(!forced && do_backlogged_job)) { | 626 | #if 0 |
627 | if (unlikely(!forced && backlogged)) { | ||
625 | /* Don't advance deadline/refresh budget. Use the remaining budget for | 628 | /* Don't advance deadline/refresh budget. Use the remaining budget for |
626 | * the backlogged job. | 629 | * the backlogged job. |
627 | * | 630 | * |
@@ -629,28 +632,36 @@ static noinline void job_completion(struct task_struct *t, int forced) | |||
629 | * blocking bound analysis. | 632 | * blocking bound analysis. |
630 | */ | 633 | */ |
631 | } | 634 | } |
635 | else if (unlikely(!forced && tsk_rt(t)->job_params.is_backlogged_job)) { | ||
636 | /* we've just about caught up, but we still have the job of this | ||
637 | * budget's allocation to do (even if it's for the future)... */ | ||
638 | TRACE_TASK(t, "Releasing final catch-up job.\n"); | ||
639 | backlogged = 1; | ||
640 | do_release = 1; | ||
641 | } | ||
632 | else { | 642 | else { |
643 | #endif | ||
633 | crm_untrack_in_top_m(t); | 644 | crm_untrack_in_top_m(t); |
634 | prepare_for_next_period(t); | 645 | prepare_for_next_period(t); |
635 | 646 | ||
636 | do_release = (is_early_releasing(t) || is_released(t, now)); | 647 | do_release = (is_early_releasing(t) || is_released(t, now)); |
637 | 648 | ||
638 | if (do_backlogged_job) { | 649 | if (backlogged) { |
639 | TRACE_TASK(t, "refreshing budget with early " | 650 | TRACE_TASK(t, "refreshing budget with early " |
640 | "release for backlogged job.\n"); | 651 | "release for backlogged job.\n"); |
641 | } | 652 | } |
642 | if (do_release || do_backlogged_job) { | 653 | if (do_release || backlogged) { |
643 | /* log here to capture overheads */ | 654 | /* log here to capture overheads */ |
644 | sched_trace_task_release(t); | 655 | sched_trace_task_release(t); |
645 | } | 656 | } |
646 | } | 657 | // } |
647 | 658 | ||
648 | unlink(t); | 659 | unlink(t); |
649 | 660 | ||
650 | /* release or arm next job */ | 661 | /* release or arm next job */ |
651 | if (is_running(t)) { | 662 | if (is_running(t)) { |
652 | /* is our next job a backlogged job? */ | 663 | /* is our next job a backlogged job? */ |
653 | if (do_backlogged_job) { | 664 | if (backlogged) { |
654 | TRACE_TASK(t, "next job is a backlogged job.\n"); | 665 | TRACE_TASK(t, "next job is a backlogged job.\n"); |
655 | tsk_rt(t)->job_params.is_backlogged_job = 1; | 666 | tsk_rt(t)->job_params.is_backlogged_job = 1; |
656 | } | 667 | } |
@@ -659,7 +670,7 @@ static noinline void job_completion(struct task_struct *t, int forced) | |||
659 | tsk_rt(t)->job_params.is_backlogged_job = 0; | 670 | tsk_rt(t)->job_params.is_backlogged_job = 0; |
660 | } | 671 | } |
661 | 672 | ||
662 | if (do_release || do_backlogged_job) { | 673 | if (do_release || backlogged) { |
663 | crm_track_in_top_m(t); | 674 | crm_track_in_top_m(t); |
664 | crm_job_arrival(t); | 675 | crm_job_arrival(t); |
665 | } | 676 | } |