diff options
Diffstat (limited to 'include/litmus/reservation.h')
-rw-r--r-- | include/litmus/reservation.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/litmus/reservation.h b/include/litmus/reservation.h index 4eecd3f088e8..0345d3482916 100644 --- a/include/litmus/reservation.h +++ b/include/litmus/reservation.h | |||
@@ -126,6 +126,9 @@ struct reservation { | |||
126 | struct reservation_ops *ops; | 126 | struct reservation_ops *ops; |
127 | 127 | ||
128 | struct list_head clients; | 128 | struct list_head clients; |
129 | |||
130 | /* for global env. */ | ||
131 | int scheduled_on; | ||
129 | }; | 132 | }; |
130 | 133 | ||
131 | void reservation_init(struct reservation *res); | 134 | void reservation_init(struct reservation *res); |
@@ -191,4 +194,56 @@ struct task_struct* sup_dispatch(struct sup_reservation_environment* sup_env); | |||
191 | struct reservation* sup_find_by_id(struct sup_reservation_environment* sup_env, | 194 | struct reservation* sup_find_by_id(struct sup_reservation_environment* sup_env, |
192 | unsigned int id); | 195 | unsigned int id); |
193 | 196 | ||
197 | #define ENV_RESCHEDULE_NOW (0) | ||
198 | #define ENV_NO_SCHEDULER_UPDATE (ULLONG_MAX) | ||
199 | |||
200 | struct next_timer_event { | ||
201 | lt_t next_event; | ||
202 | int timer_armed_on; | ||
203 | struct list_head list; | ||
204 | }; | ||
205 | |||
206 | /* A global multiprocessor reservation environment. | ||
207 | */ | ||
208 | struct gmp_reservation_environment { | ||
209 | //raw_spinlock_t lock; | ||
210 | struct reservation_environment env; | ||
211 | |||
212 | /* ordered by priority */ | ||
213 | struct list_head active_reservations; | ||
214 | |||
215 | /* ordered by next_replenishment */ | ||
216 | struct list_head depleted_reservations; | ||
217 | |||
218 | /* unordered */ | ||
219 | struct list_head inactive_reservations; | ||
220 | |||
221 | /* - ENV_RESCHEDULE_NOW means call gmp_dispatch() now | ||
222 | * - ENV_NO_SCHEDULER_UPDATE means nothing to do | ||
223 | * any other value means program a timer for the given time | ||
224 | */ | ||
225 | struct list_head next_events; | ||
226 | raw_spinlock_t event_lock; | ||
227 | bool schedule_now; | ||
228 | /* set to true if a call to gmp_dispatch() is imminent */ | ||
229 | bool will_schedule; | ||
230 | }; | ||
231 | |||
232 | /* Contract: | ||
233 | * - before calling into sup_ code, or any reservation methods, | ||
234 | * update the time with sup_update_time(); and | ||
235 | * - after calling into sup_ code, or any reservation methods, | ||
236 | * check next_scheduler_update and program timer or trigger | ||
237 | * scheduler invocation accordingly. | ||
238 | */ | ||
239 | |||
240 | void gmp_init(struct gmp_reservation_environment* gmp_env); | ||
241 | void gmp_add_new_reservation(struct gmp_reservation_environment* gmp_env, | ||
242 | struct reservation* new_res); | ||
243 | void gmp_update_time(struct gmp_reservation_environment* gmp_env, lt_t now); | ||
244 | struct task_struct* gmp_dispatch(struct gmp_reservation_environment* gmp_env); | ||
245 | |||
246 | struct reservation* gmp_find_by_id(struct gmp_reservation_environment* gmp_env, | ||
247 | unsigned int id); | ||
248 | |||
194 | #endif | 249 | #endif |