aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus
diff options
context:
space:
mode:
authorMing Yang <yang@cs.unc.edu>2016-02-10 10:58:42 -0500
committerMing Yang <yang@cs.unc.edu>2016-02-10 18:05:12 -0500
commit696546dd52d9baf73920a61e6525a41f3460ba4d (patch)
tree7093c4b6ba8af2714101d400fdc3e987098c9d47 /include/litmus
parent3dfe2804d7ccc6b7f0e2e44175249b38299c83e7 (diff)
Patched reservation implementation of MC^2 version
Patched using Namhoon's implementation of reservation for MC^2 to support global multiprocessor scheduling. Patched compiler-gcc5 to support gcc v5 compiler. Bug fixed regarding user input big cpu id number causing kernel crash.
Diffstat (limited to 'include/litmus')
-rw-r--r--include/litmus/reservation.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/include/litmus/reservation.h b/include/litmus/reservation.h
index 4eecd3f088e8..af1fba297bf5 100644
--- a/include/litmus/reservation.h
+++ b/include/litmus/reservation.h
@@ -126,6 +126,14 @@ 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;
132 int event_added;
133 /* for blocked by ghost. Do not charge budget when ACTIVE */
134 int blocked_by_ghost;
135 /* ghost_job. If it is clear, do not charge budget when ACTIVE_IDLE */
136 int is_ghost;
129}; 137};
130 138
131void reservation_init(struct reservation *res); 139void reservation_init(struct reservation *res);
@@ -185,10 +193,67 @@ struct sup_reservation_environment {
185void sup_init(struct sup_reservation_environment* sup_env); 193void sup_init(struct sup_reservation_environment* sup_env);
186void sup_add_new_reservation(struct sup_reservation_environment* sup_env, 194void sup_add_new_reservation(struct sup_reservation_environment* sup_env,
187 struct reservation* new_res); 195 struct reservation* new_res);
196/*
197 * TODO this function is added from Namhoon's implementation for MC^2.
198 * The need of this declaration is that it's used explicitly outside.
199 */
200void sup_scheduler_update_after(struct sup_reservation_environment* sup_env,
201 lt_t timeout);
188void sup_update_time(struct sup_reservation_environment* sup_env, lt_t now); 202void sup_update_time(struct sup_reservation_environment* sup_env, lt_t now);
189struct task_struct* sup_dispatch(struct sup_reservation_environment* sup_env); 203struct task_struct* sup_dispatch(struct sup_reservation_environment* sup_env);
190 204
191struct reservation* sup_find_by_id(struct sup_reservation_environment* sup_env, 205struct reservation* sup_find_by_id(struct sup_reservation_environment* sup_env,
192 unsigned int id); 206 unsigned int id);
193 207
208/* A global multiprocessor reservation environment. */
209
210typedef enum {
211 EVENT_REPLENISH = 0,
212 EVENT_DRAIN,
213 EVENT_OTHERS,
214} event_type_t;
215
216
217struct next_timer_event {
218 lt_t next_update;
219 int timer_armed_on;
220 unsigned int id;
221 event_type_t type;
222 struct list_head list;
223};
224
225struct gmp_reservation_environment {
226 raw_spinlock_t lock;
227 struct reservation_environment env;
228
229 /* ordered by priority */
230 struct list_head active_reservations;
231
232 /* ordered by next_replenishment */
233 struct list_head depleted_reservations;
234
235 /* unordered */
236 struct list_head inactive_reservations;
237
238 /* timer event ordered by next_update */
239 struct list_head next_events;
240
241 /* (schedule_now == true) means call gmp_dispatch() now */
242 int schedule_now;
243 /* set to true if a call to gmp_dispatch() is imminent */
244 bool will_schedule;
245};
246
247void gmp_init(struct gmp_reservation_environment* gmp_env);
248void gmp_add_new_reservation(struct gmp_reservation_environment* gmp_env,
249 struct reservation* new_res);
250void gmp_add_event_after(struct gmp_reservation_environment* gmp_env,
251 lt_t timeout, unsigned int id, event_type_t type);
252void gmp_print_events(struct gmp_reservation_environment* gmp_env, lt_t now);
253int gmp_update_time(struct gmp_reservation_environment* gmp_env, lt_t now);
254struct task_struct* gmp_dispatch(struct gmp_reservation_environment* gmp_env);
255struct next_timer_event* gmp_find_event_by_id(struct gmp_reservation_environment* gmp_env, unsigned int id);
256struct next_timer_event* gmp_find_event_by_time(struct gmp_reservation_environment* gmp_env, lt_t when);
257struct reservation* gmp_find_by_id(struct gmp_reservation_environment* gmp_env,
258 unsigned int id);
194#endif 259#endif