aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhoon Kim <namhoonk@cs.unc.edu>2014-09-04 15:30:12 -0400
committerNamhoon Kim <namhoonk@cs.unc.edu>2014-11-03 21:58:26 -0500
commit90add7e63ec95fcf81e311ffc1c036382ac28347 (patch)
tree39a8cc6192a77f5c80725a1f2967345ee7dac120
parentbb1ee06d3b70f0d546cbf829a9ffe3ff7e800e8a (diff)
Fix scheduler invocation after draining budget
-rw-r--r--litmus/reservation.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/litmus/reservation.c b/litmus/reservation.c
index bc32b2ecace4..cd51b90c14a0 100644
--- a/litmus/reservation.c
+++ b/litmus/reservation.c
@@ -180,18 +180,31 @@ static void sup_charge_budget(
180{ 180{
181 struct list_head *pos, *next; 181 struct list_head *pos, *next;
182 struct reservation *res; 182 struct reservation *res;
183
184 int encountered_active = 0;
183 185
184 list_for_each_safe(pos, next, &sup_env->active_reservations) { 186 list_for_each_safe(pos, next, &sup_env->active_reservations) {
185 /* charge all ACTIVE_IDLE up to the first ACTIVE reservation */ 187 /* charge all ACTIVE_IDLE up to the first ACTIVE reservation */
186 res = list_entry(pos, struct reservation, list); 188 res = list_entry(pos, struct reservation, list);
187 if (res->state == RESERVATION_ACTIVE) { 189 if (res->state == RESERVATION_ACTIVE) {
188 res->ops->drain_budget(res, delta); 190 res->ops->drain_budget(res, delta);
189 /* stop at the first ACTIVE reservation */ 191 encountered_active = 1;
190 break;
191 } else { 192 } else {
192 BUG_ON(res->state != RESERVATION_ACTIVE_IDLE); 193 BUG_ON(res->state != RESERVATION_ACTIVE_IDLE);
193 res->ops->drain_budget(res, delta); 194 res->ops->drain_budget(res, delta);
194 } 195 }
196 if (res->state == RESERVATION_ACTIVE ||
197 res->state == RESERVATION_ACTIVE_IDLE)
198 {
199 /* make sure scheduler is invoked when this reservation expires
200 * its remaining budget */
201 TRACE("requesting scheduler update for reservation %u in %llu nanoseconds\n",
202 res->id, res->cur_budget);
203 sup_scheduler_update_after(sup_env, res->cur_budget);
204 }
205 if (encountered_active)
206 /* stop at the first ACTIVE reservation */
207 break;
195 } 208 }
196} 209}
197 210
@@ -226,6 +239,7 @@ void sup_update_time(
226 /* If the time didn't advance, there is nothing to do. 239 /* If the time didn't advance, there is nothing to do.
227 * This check makes it safe to call sup_advance_time() potentially 240 * This check makes it safe to call sup_advance_time() potentially
228 * multiple times (e.g., via different code paths. */ 241 * multiple times (e.g., via different code paths. */
242 TRACE("(sup_update_time) now: %llu, current_time: %llu\n", now, sup_env->env.current_time);
229 if (unlikely(now <= sup_env->env.current_time)) 243 if (unlikely(now <= sup_env->env.current_time))
230 return; 244 return;
231 245