aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
Diffstat (limited to 'litmus')
-rw-r--r--litmus/budget.c18
-rw-r--r--litmus/jobs.c1
-rw-r--r--litmus/sched_mc.c5
3 files changed, 22 insertions, 2 deletions
diff --git a/litmus/budget.c b/litmus/budget.c
index 310e9a3d4172..75f4b5156947 100644
--- a/litmus/budget.c
+++ b/litmus/budget.c
@@ -4,6 +4,7 @@
4 4
5#include <litmus/litmus.h> 5#include <litmus/litmus.h>
6#include <litmus/preempt.h> 6#include <litmus/preempt.h>
7#include <litmus/budget.h>
7 8
8struct enforcement_timer { 9struct enforcement_timer {
9 /* The enforcement timer is used to accurately police 10 /* The enforcement timer is used to accurately police
@@ -108,4 +109,21 @@ static int __init init_budget_enforcement(void)
108 return 0; 109 return 0;
109} 110}
110 111
112void prepare_for_next_server(struct task_struct *t, int forced)
113{
114 if (!job_behind(t)) {
115 t->rt_param.job_params.release = t->rt_param.job_params.deadline;
116 t->rt_param.job_params.deadline += get_rt_period(t);
117 t->rt_param.job_params.exec_time = 0;
118 /* update job sequence number */
119 t->rt_param.job_params.job_no++;
120 } else if (forced) {
121 t->rt_param.job_params.release = t->rt_param.job_params.deadline;
122 t->rt_param.job_params.exec_time = 0;
123 } else /* behind */{
124 t->rt_param.job_params.deadline += get_rt_period(t);
125 t->rt_param.job_params.job_no++;
126 }
127}
128
111module_init(init_budget_enforcement); 129module_init(init_budget_enforcement);
diff --git a/litmus/jobs.c b/litmus/jobs.c
index 36e314625d86..669a3df5fcc1 100644
--- a/litmus/jobs.c
+++ b/litmus/jobs.c
@@ -10,6 +10,7 @@ void prepare_for_next_period(struct task_struct *t)
10{ 10{
11 BUG_ON(!t); 11 BUG_ON(!t);
12 /* prepare next release */ 12 /* prepare next release */
13
13 t->rt_param.job_params.release = t->rt_param.job_params.deadline; 14 t->rt_param.job_params.release = t->rt_param.job_params.deadline;
14 t->rt_param.job_params.deadline += get_rt_period(t); 15 t->rt_param.job_params.deadline += get_rt_period(t);
15 t->rt_param.job_params.exec_time = 0; 16 t->rt_param.job_params.exec_time = 0;
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c
index 8828919dfcf2..ddd5933da4f8 100644
--- a/litmus/sched_mc.c
+++ b/litmus/sched_mc.c
@@ -24,6 +24,7 @@
24#include <litmus/domain.h> 24#include <litmus/domain.h>
25#include <litmus/bheap.h> 25#include <litmus/bheap.h>
26#include <litmus/event_group.h> 26#include <litmus/event_group.h>
27#include <litmus/budget.h>
27 28
28#include <litmus/sched_mc.h> 29#include <litmus/sched_mc.h>
29#include <litmus/ce_domain.h> 30#include <litmus/ce_domain.h>
@@ -595,7 +596,7 @@ static void job_completion(struct task_struct *task, int forced)
595 now = litmus_clock(); 596 now = litmus_clock();
596 597
597 /* If it's not a ghost job, do ghost job conversion */ 598 /* If it's not a ghost job, do ghost job conversion */
598 if (!is_ghost(task)) { 599 if (!is_ghost(task) && !job_behind(task)) {
599 TRACE_MC_TASK(task, "is not a ghost task\n"); 600 TRACE_MC_TASK(task, "is not a ghost task\n");
600 tsk_mc_data(task)->mc_job.ghost_budget = budget_remaining(task); 601 tsk_mc_data(task)->mc_job.ghost_budget = budget_remaining(task);
601 tsk_mc_data(task)->mc_job.is_ghost = 1; 602 tsk_mc_data(task)->mc_job.is_ghost = 1;
@@ -608,7 +609,7 @@ static void job_completion(struct task_struct *task, int forced)
608 if (tsk_mc_data(task)->mc_job.ghost_budget == 0) { 609 if (tsk_mc_data(task)->mc_job.ghost_budget == 0) {
609 TRACE_MC_TASK(task, "has zero ghost budget\n"); 610 TRACE_MC_TASK(task, "has zero ghost budget\n");
610 tsk_mc_data(task)->mc_job.is_ghost = 0; 611 tsk_mc_data(task)->mc_job.is_ghost = 0;
611 prepare_for_next_period(task); 612 prepare_for_next_server(task, forced);
612 if (is_released(task, litmus_clock())) 613 if (is_released(task, litmus_clock()))
613 sched_trace_task_release(task); 614 sched_trace_task_release(task);
614 } 615 }