diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-10-14 14:54:47 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-10-14 14:54:47 -0400 |
commit | cfb2b53f2d1c16d8d5f7197af2b034f6bc2d2fd4 (patch) | |
tree | 4efe59701179902e66a8a1813981e282c7384a59 | |
parent | 3d00edf817b71eb95440c72689e0c5657fd29dd0 (diff) |
Checkpoint
-rw-r--r-- | include/litmus/budget.h | 4 | ||||
-rw-r--r-- | litmus/budget.c | 18 | ||||
-rw-r--r-- | litmus/jobs.c | 1 | ||||
-rw-r--r-- | litmus/sched_mc.c | 5 |
4 files changed, 26 insertions, 2 deletions
diff --git a/include/litmus/budget.h b/include/litmus/budget.h index 732530e63491..559cfcdda61a 100644 --- a/include/litmus/budget.h +++ b/include/litmus/budget.h | |||
@@ -5,4 +5,8 @@ | |||
5 | * the next task. */ | 5 | * the next task. */ |
6 | void update_enforcement_timer(struct task_struct* t); | 6 | void update_enforcement_timer(struct task_struct* t); |
7 | 7 | ||
8 | void prepare_for_next_server(struct task_struct* t,int forced); | ||
9 | |||
10 | #define job_behind(t) (lt_before_eq((t)->rt_param.job_params.deadline, \ | ||
11 | (t)->rt_param.job_params.release)) | ||
8 | #endif | 12 | #endif |
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 | ||
8 | struct enforcement_timer { | 9 | struct 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 | ||
112 | void 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 | |||
111 | module_init(init_budget_enforcement); | 129 | module_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 | } |