diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2014-09-11 06:53:42 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2014-09-11 06:53:42 -0400 |
commit | 9ec32807edf33064734a815c949668704a07c5f3 (patch) | |
tree | a182de2c27e5b2539d38488dff3cf5ac54cba6c5 | |
parent | e18fc708a32b2ee6b48e648cd2ac767eb76be5e5 (diff) |
Move 'reservation' field from task_client to generic reservation_client
This makes it a lot easier to write generic code for thread arrival /
thread departure in plugins with multiple types of reservation
clients.
-rw-r--r-- | include/litmus/reservation.h | 5 | ||||
-rw-r--r-- | litmus/reservation.c | 4 | ||||
-rw-r--r-- | litmus/sched_pres.c | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/include/litmus/reservation.h b/include/litmus/reservation.h index d8d6ce37dc47..9c23e27165b2 100644 --- a/include/litmus/reservation.h +++ b/include/litmus/reservation.h | |||
@@ -33,9 +33,11 @@ typedef struct task_struct * (*dispatch_t) ( | |||
33 | ); | 33 | ); |
34 | 34 | ||
35 | /* Something that can be managed in a reservation and that can yield | 35 | /* Something that can be managed in a reservation and that can yield |
36 | * a process for dispatching. */ | 36 | * a process for dispatching. Contains a pointer to the reservation |
37 | * to which it "belongs". */ | ||
37 | struct reservation_client { | 38 | struct reservation_client { |
38 | struct list_head list; | 39 | struct list_head list; |
40 | struct reservation* reservation; | ||
39 | dispatch_t dispatch; | 41 | dispatch_t dispatch; |
40 | }; | 42 | }; |
41 | 43 | ||
@@ -135,7 +137,6 @@ struct task_struct* default_dispatch_client( | |||
135 | /* "connector" reservation client to hook up tasks with reservations */ | 137 | /* "connector" reservation client to hook up tasks with reservations */ |
136 | struct task_client { | 138 | struct task_client { |
137 | struct reservation_client client; | 139 | struct reservation_client client; |
138 | struct reservation* reservation; | ||
139 | struct task_struct *task; | 140 | struct task_struct *task; |
140 | }; | 141 | }; |
141 | 142 | ||
diff --git a/litmus/reservation.c b/litmus/reservation.c index cd51b90c14a0..447fc5b1be23 100644 --- a/litmus/reservation.c +++ b/litmus/reservation.c | |||
@@ -40,8 +40,8 @@ void task_client_init(struct task_client *tc, struct task_struct *tsk, | |||
40 | { | 40 | { |
41 | memset(&tc->client, sizeof(tc->client), 0); | 41 | memset(&tc->client, sizeof(tc->client), 0); |
42 | tc->client.dispatch = task_client_dispatch; | 42 | tc->client.dispatch = task_client_dispatch; |
43 | tc->client.reservation = res; | ||
43 | tc->task = tsk; | 44 | tc->task = tsk; |
44 | tc->reservation = res; | ||
45 | } | 45 | } |
46 | 46 | ||
47 | static void sup_scheduler_update_at( | 47 | static void sup_scheduler_update_at( |
@@ -180,7 +180,7 @@ 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 | 183 | ||
184 | int encountered_active = 0; | 184 | int encountered_active = 0; |
185 | 185 | ||
186 | list_for_each_safe(pos, next, &sup_env->active_reservations) { | 186 | list_for_each_safe(pos, next, &sup_env->active_reservations) { |
diff --git a/litmus/sched_pres.c b/litmus/sched_pres.c index 60afde6f8d1b..2c777ec34658 100644 --- a/litmus/sched_pres.c +++ b/litmus/sched_pres.c | |||
@@ -45,7 +45,7 @@ static void task_departs(struct task_struct *tsk, int job_complete) | |||
45 | struct reservation* res; | 45 | struct reservation* res; |
46 | struct reservation_client *client; | 46 | struct reservation_client *client; |
47 | 47 | ||
48 | res = state->res_info.reservation; | 48 | res = state->res_info.client.reservation; |
49 | client = &state->res_info.client; | 49 | client = &state->res_info.client; |
50 | 50 | ||
51 | res->ops->client_departs(res, client, job_complete); | 51 | res->ops->client_departs(res, client, job_complete); |
@@ -57,7 +57,7 @@ static void task_arrives(struct task_struct *tsk) | |||
57 | struct reservation* res; | 57 | struct reservation* res; |
58 | struct reservation_client *client; | 58 | struct reservation_client *client; |
59 | 59 | ||
60 | res = state->res_info.reservation; | 60 | res = state->res_info.client.reservation; |
61 | client = &state->res_info.client; | 61 | client = &state->res_info.client; |
62 | 62 | ||
63 | res->ops->client_arrives(res, client); | 63 | res->ops->client_arrives(res, client); |