aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-09-21 19:56:08 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-09-21 19:56:08 -0400
commit77cf5fd8322fa4cb93c4674220bee13a11c96db2 (patch)
tree111311499bb5b67c9b09e80a7ab09ea01ea2f6d1
parent97d6bd2cb13501d6b68f08fdf72a1f48607b38ab (diff)
Undo WM damage to common files
-rw-r--r--include/litmus/jobs.h2
-rw-r--r--include/litmus/litmus.h24
-rw-r--r--litmus/jobs.c70
-rw-r--r--litmus/sched_litmus.c2
4 files changed, 3 insertions, 95 deletions
diff --git a/include/litmus/jobs.h b/include/litmus/jobs.h
index cebe18d615da..9bd361ef3943 100644
--- a/include/litmus/jobs.h
+++ b/include/litmus/jobs.h
@@ -5,7 +5,5 @@ void prepare_for_next_period(struct task_struct *t);
5void release_at(struct task_struct *t, lt_t start); 5void release_at(struct task_struct *t, lt_t start);
6long complete_job(void); 6long complete_job(void);
7 7
8void prepare_next_slice(struct task_struct *t, int new_release);
9
10#endif 8#endif
11 9
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h
index 9731578e8b0e..674528eece14 100644
--- a/include/litmus/litmus.h
+++ b/include/litmus/litmus.h
@@ -80,35 +80,11 @@ void litmus_exit_task(struct task_struct *tsk);
80#define get_release(t) (tsk_rt(t)->job_params.release) 80#define get_release(t) (tsk_rt(t)->job_params.release)
81#define get_class(t) (tsk_rt(t)->task_params.cls) 81#define get_class(t) (tsk_rt(t)->task_params.cls)
82 82
83
84/* Realtime utility macros for semi-partitioned algorithm - Migrating Task.
85 * These macros provide per cpu accounting stats.
86 * */
87
88#define get_cpu_period(t) (tsk_rt(t)->task_params.periods[tsk_rt(t)->task_params.curr])
89#define get_cpu_exec_cost(t) (tsk_rt(t)->task_params.wcets[tsk_rt(t)->task_params.curr])
90#define get_rt_cpu_phase(t,cpu) (tsk_rt(t)->task_params.phases[cpu])
91#define get_cpu_partition(t) (tsk_rt(t)->task_params.cpus[tsk_rt(t)->task_params.curr])
92#define get_cpu_exec_time(t) (tsk_rt(t)->job_params.exec_time_curr_cpu)
93
94inline static int budget_exhausted(struct task_struct* t) 83inline static int budget_exhausted(struct task_struct* t)
95{ 84{
96 return get_exec_time(t) >= get_exec_cost(t); 85 return get_exec_time(t) >= get_exec_cost(t);
97} 86}
98 87
99
100/* Check whether the task has exhausted its budget on current cpu */
101
102inline static int cpu_budget_exhausted(struct task_struct* t,int flag)
103{
104 if(t->rt_param.task_params.count > 1 && flag){
105 return get_cpu_exec_time(t) >= get_cpu_exec_cost(t);
106 }
107 else{
108 return budget_exhausted(t);
109 }
110}
111
112#define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT) 88#define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT)
113 89
114 90
diff --git a/litmus/jobs.c b/litmus/jobs.c
index 4eed6e04fe0e..36e314625d86 100644
--- a/litmus/jobs.c
+++ b/litmus/jobs.c
@@ -13,39 +13,17 @@ void prepare_for_next_period(struct task_struct *t)
13 t->rt_param.job_params.release = t->rt_param.job_params.deadline; 13 t->rt_param.job_params.release = t->rt_param.job_params.deadline;
14 t->rt_param.job_params.deadline += get_rt_period(t); 14 t->rt_param.job_params.deadline += get_rt_period(t);
15 t->rt_param.job_params.exec_time = 0; 15 t->rt_param.job_params.exec_time = 0;
16 t->rt_param.job_params.exec_time_curr_cpu = 0;
17 /* update job sequence number */ 16 /* update job sequence number */
18 t->rt_param.job_params.job_no++; 17 t->rt_param.job_params.job_no++;
19 t->rt_param.job_params.execs[0] = t->rt_param.task_params.exec_cost; 18
20 /* don't confuse Linux */ 19 /* don't confuse Linux */
21 t->rt.time_slice = 1; 20 t->rt.time_slice = 1;
22} 21}
23 22
24
25/*
26 * Prepare a task for release on next CPU for a semi-partitioned algorithm.
27 * This function prepares the next slice of a job or next job (if all slices are over) for release on next cpu.
28 *
29 */
30
31void release_at(struct task_struct *t, lt_t start) 23void release_at(struct task_struct *t, lt_t start)
32{ 24{
33 int i=0; 25 t->rt_param.job_params.deadline = start;
34 if(t->rt_param.task_params.count > 1){ 26 prepare_for_next_period(t);
35 /* Migratory task. Initialize deadline and call prepare_next_slice() */
36 for(i=0;i<t->rt_param.task_params.count;i++){
37 t->rt_param.job_params.deadlines[i] = start;
38 }
39 prepare_next_slice(t,1);
40 TRACE_TASK(t,"Current CPU : %d, Execution Time on this cpu : %llu\n",t->rt_param.task_params.cpus[t->rt_param.task_params.curr],get_cpu_exec_cost(t));
41 }
42 else{
43 /* Fixed task. Handle it the normal way */
44 t->rt_param.job_params.deadline = start;
45 TRACE_TASK(t,"Current CPU : %d\n",t->rt_param.task_params.cpu);
46 prepare_for_next_period(t);
47 TRACE_TASK(t,"Current CPU : %d, Execution Time on this cpu : %llu\n",t->rt_param.task_params.cpu,get_exec_cost(t));
48 }
49 set_rt_flags(t, RT_F_RUNNING); 27 set_rt_flags(t, RT_F_RUNNING);
50} 28}
51 29
@@ -63,45 +41,3 @@ long complete_job(void)
63 schedule(); 41 schedule();
64 return 0; 42 return 0;
65} 43}
66
67
68void prepare_next_slice(struct task_struct *t, int new_release)
69{
70 int i;
71 BUG_ON(!t);
72
73 if(t->rt_param.job_params.job_no == 0){
74 /* This is the first job of this task. Update all parameters such as release time, deadline for each slice. */
75 TRACE_TASK(t,"Setting for first time\n");
76 for(i=0;i<t->rt_param.task_params.count;i++){
77 t->rt_param.job_params.releases[i] = t->rt_param.job_params.deadlines[i] + i * ( t->rt_param.task_params.period / t->rt_param.task_params.count);
78 t->rt_param.job_params.deadlines[i] = t->rt_param.job_params.releases[i] + (t->rt_param.task_params.period / t->rt_param.task_params.count);
79 t->rt_param.job_params.execs[i] = t->rt_param.task_params.wcets[i];
80 }
81 t->rt_param.job_params.job_no++;
82 }
83 else if(t->rt_param.task_params.curr == 0){
84 /* this is new job of this task. Update all parameters such as release time, deadline for each slice. */
85 for(i=0;i<t->rt_param.task_params.count;i++){
86 if(!new_release){
87 t->rt_param.job_params.releases[i] += t->rt_param.task_params.period;
88 }
89 else{
90 t->rt_param.job_params.releases[i] = t->rt_param.job_params.deadlines[i] + i * ( t->rt_param.task_params.period / t->rt_param.task_params.count);
91 }
92 t->rt_param.job_params.deadlines[i] = t->rt_param.job_params.releases[i] + (t->rt_param.task_params.period / t->rt_param.task_params.count);
93 t->rt_param.job_params.execs[i] = t->rt_param.task_params.wcets[i];
94 }
95 t->rt_param.job_params.job_no++;
96 t->rt_param.job_params.exec_time = 0;
97 }
98
99 /* Set the job's current release time and deadline to be the deadline of current slice. */
100 t->rt_param.task_params.cpu = t->rt_param.task_params.cpus[t->rt_param.task_params.curr];
101 t->rt_param.job_params.exec_time_curr_cpu = 0;
102 t->rt_param.job_params.release = t->rt_param.job_params.releases[t->rt_param.task_params.curr];
103 t->rt_param.job_params.deadline = t->rt_param.job_params.deadlines[t->rt_param.task_params.curr];
104
105 /* don't confuse Linux */
106 t->rt.time_slice = 1;
107}
diff --git a/litmus/sched_litmus.c b/litmus/sched_litmus.c
index 72858b84b7e7..c65388969789 100644
--- a/litmus/sched_litmus.c
+++ b/litmus/sched_litmus.c
@@ -10,8 +10,6 @@ static void update_time_litmus(struct rq *rq, struct task_struct *p)
10 delta = 0; 10 delta = 0;
11 /* per job counter */ 11 /* per job counter */
12 p->rt_param.job_params.exec_time += delta; 12 p->rt_param.job_params.exec_time += delta;
13
14 p->rt_param.job_params.exec_time_curr_cpu += delta;
15 /* task counter */ 13 /* task counter */
16 p->se.sum_exec_runtime += delta; 14 p->se.sum_exec_runtime += delta;
17 /* sched_clock() */ 15 /* sched_clock() */