aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_mc2.c
diff options
context:
space:
mode:
Diffstat (limited to 'litmus/sched_mc2.c')
-rw-r--r--litmus/sched_mc2.c70
1 files changed, 51 insertions, 19 deletions
diff --git a/litmus/sched_mc2.c b/litmus/sched_mc2.c
index ee04315c44a0..aea18dec71f5 100644
--- a/litmus/sched_mc2.c
+++ b/litmus/sched_mc2.c
@@ -128,25 +128,53 @@ asmlinkage int sys_enact_mode(void)
128 raw_spin_lock(&global_lock); 128 raw_spin_lock(&global_lock);
129 raw_spin_lock(&mode_lock); 129 raw_spin_lock(&mode_lock);
130 if (mode != requested_mode //MCR has entered 130 if (mode != requested_mode //MCR has entered
131 && !res_reported){ //and C is throttled 131 if( !res_reported){ //and C is throttled
132 mode = requested_mode; 132 mode = requested_mode;
133 _global_env = &_global_env_modes[mode]; 133 _global_env = &_global_env_modes[mode];
134 //set res->reported for new global tasks 134 //set res->reported for new global tasks
135 list_for_each(pos, &_global_env->active_reservations){ 135 list_for_each(pos, &_global_env->active_reservations){
136 res = list_entry(pos, struct reservation, list); 136 res = list_entry(pos, struct reservation, list);
137 137 res->reported = 0;
138 res->reported = 0; 138 }
139 } 139 list_for_each(pos, &_global_env->depleted_reservations){
140 list_for_each(pos, &_global_env->depleted_reservations){ 140 res = list_entry(pos, struct reservation, list);
141 res = list_entry(pos, struct reservation, list); 141 res->reported = 0;
142 res->reported = 0; 142 }
143 list_for_each(pos, &_global_env->inactive_reservations){
144 res = list_entry(pos, struct reservation, list);
145 res->reported = 0;
146 res->env->change_state(res->env, res, RESERVATION_ACTIVE);
147 }
148 //gmp_update_time(_global_env, now);
143 } 149 }
144 list_for_each(pos, &_global_env->inactive_reservations){ 150 else{
145 res = list_entry(pos, struct reservation, list); 151 list_for_each(pos, &_global_env->active_reservations){
146 res->reported = 0; 152 res = list_entry(pos, struct reservation, list);
147 res->env->change_state(res->env, res, RESERVATION_ACTIVE); 153 if (tsk_rt(res->tsk)->completed){
154 res->env->change_state(res->env, res, RESERVATION_INACTIVE);
155 res->reported = 1;
156 res_reported--;
157 }
158 }
159 list_for_each(pos, &_global_env->depleted_reservations){
160 res = list_entry(pos, struct reservation, list);
161 if (tsk_rt(res->tsk)->completed){
162 res->env->change_state(res->env, res, RESERVATION_INACTIVE);
163 res->reported = 1;
164 res_reported--;
165 }
166
167 }
168 list_for_each(pos, &_global_env->inactive_reservations){
169 res = list_entry(pos, struct reservation, list);
170 if (tsk_rt(res->tsk)->completed){
171 res->env->change_state(res->env, res, RESERVATION_INACTIVE);
172 res->reported = 1;
173 res_reported--;
174 }
175 }
148 } 176 }
149 //gmp_update_time(_global_env, now); 177
150 } 178 }
151 raw_spin_unlock(&mode_lock); 179 raw_spin_unlock(&mode_lock);
152 raw_spin_unlock(&global_lock); 180 raw_spin_unlock(&global_lock);
@@ -617,9 +645,11 @@ static long mc2_complete_job(void)
617 long err; 645 long err;
618 646
619 enum crit_level lv; 647 enum crit_level lv;
620
621 tsk_rt(current)->completed = 1;
622 648
649 raw_spin_lock(&mode_lock);
650 tsk_rt(current)->completed = 1;
651 raw_spin_unlock(&mode_lock);
652
623 lv = get_task_crit_level(current); 653 lv = get_task_crit_level(current);
624 654
625 /* If this the first job instance, we need to reset replenish 655 /* If this the first job instance, we need to reset replenish
@@ -734,7 +764,9 @@ static long mc2_complete_job(void)
734 764
735 TRACE_CUR("mc2_complete_job returns at %llu\n", litmus_clock()); 765 TRACE_CUR("mc2_complete_job returns at %llu\n", litmus_clock());
736 766
767 raw_spin_lock(&mode_lock);
737 tsk_rt(current)->completed = 0; 768 tsk_rt(current)->completed = 0;
769 raw_spin_unlock(&mode_lock);
738 return err; 770 return err;
739} 771}
740 772