diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-04-06 13:56:22 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-04-06 13:56:22 -0400 |
commit | 92d266b64e0def8554ebece70318a5ae0050573a (patch) | |
tree | a10f170121b45172df816a8d662024754cbbee5f | |
parent | 886c672274a1807d108d995438937e1ee1c4fe89 (diff) |
Implement OMLP-Family budget exhaustion hooks.
-rw-r--r-- | include/litmus/locking.h | 4 | ||||
-rw-r--r-- | include/litmus/rt_param.h | 1 | ||||
-rw-r--r-- | litmus/budget.c | 7 | ||||
-rw-r--r-- | litmus/locking.c | 11 | ||||
-rw-r--r-- | litmus/sched_cedf.c | 2 |
5 files changed, 19 insertions, 6 deletions
diff --git a/include/litmus/locking.h b/include/litmus/locking.h index 08b06200b955..4dd8c66868e6 100644 --- a/include/litmus/locking.h +++ b/include/litmus/locking.h | |||
@@ -242,10 +242,10 @@ int wake_up_for_lock(struct task_struct* t); | |||
242 | 242 | ||
243 | /* thread safe?? */ | 243 | /* thread safe?? */ |
244 | #ifndef CONFIG_LITMUS_NESTED_LOCKING | 244 | #ifndef CONFIG_LITMUS_NESTED_LOCKING |
245 | #define holds_locks(tsk) \ | 245 | #define holds_locks(t) \ |
246 | (tsk_rt(t)->num_locks_held || tsk_rt(t)->num_local_locks_held) | 246 | (tsk_rt(t)->num_locks_held || tsk_rt(t)->num_local_locks_held) |
247 | #else | 247 | #else |
248 | #define holds_locks(tsk) \ | 248 | #define holds_locks(t) \ |
249 | (tsk_rt(t)->num_locks_held || tsk_rt(t)->num_local_locks_held || !binheap_empty(&tsk_rt(t)->hp_blocked_tasks)) | 249 | (tsk_rt(t)->num_locks_held || tsk_rt(t)->num_local_locks_held || !binheap_empty(&tsk_rt(t)->hp_blocked_tasks)) |
250 | #endif | 250 | #endif |
251 | 251 | ||
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index 3f3aa240778f..a1cfdb6b6416 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
@@ -406,6 +406,7 @@ struct rt_param { | |||
406 | 406 | ||
407 | /* pointer to lock upon which is currently blocked */ | 407 | /* pointer to lock upon which is currently blocked */ |
408 | struct litmus_lock* blocked_lock; | 408 | struct litmus_lock* blocked_lock; |
409 | struct litmus_lock* outermost_lock; | ||
409 | #endif | 410 | #endif |
410 | 411 | ||
411 | /* user controlled parameters */ | 412 | /* user controlled parameters */ |
diff --git a/litmus/budget.c b/litmus/budget.c index dd5f311c8b4a..4f692fd4a103 100644 --- a/litmus/budget.c +++ b/litmus/budget.c | |||
@@ -318,8 +318,11 @@ void sobliv_revaluate_task(struct task_struct* t) | |||
318 | "CONFIG_LITMUS_NESTED_LOCKING enabled.\n"); | 318 | "CONFIG_LITMUS_NESTED_LOCKING enabled.\n"); |
319 | #endif | 319 | #endif |
320 | 320 | ||
321 | /* TODO: If we hold an OMLP-family outmost lock, then we may | 321 | /* Move a waiter onto a FIFO queue to simulate an unlock call. */ |
322 | * need to move a task into a fifo queue */ | 322 | if (tsk_rt(t)->outermost_lock && |
323 | tsk_rt(t)->outermost_lock->ops->is_omlp_family) { | ||
324 | tsk_rt(t)->outermost_lock->ops->omlp_virtual_unlock(tsk_rt(t)->outermost_lock, t); | ||
325 | } | ||
323 | } | 326 | } |
324 | 327 | ||
325 | 328 | ||
diff --git a/litmus/locking.c b/litmus/locking.c index d347fdce4cb7..88905d4cff26 100644 --- a/litmus/locking.c +++ b/litmus/locking.c | |||
@@ -125,6 +125,11 @@ asmlinkage long sys_litmus_lock(int lock_od) | |||
125 | sched_trace_lock(current, l->ident, 1); | 125 | sched_trace_lock(current, l->ident, 1); |
126 | 126 | ||
127 | TRACE_CUR("Got lock %d\n", l->ident); | 127 | TRACE_CUR("Got lock %d\n", l->ident); |
128 | |||
129 | if (tsk_rt(current)->outermost_lock == NULL) { | ||
130 | TRACE_CUR("Lock %d is outermost lock.\n", l->ident); | ||
131 | tsk_rt(current)->outermost_lock = l; | ||
132 | } | ||
128 | } | 133 | } |
129 | } | 134 | } |
130 | 135 | ||
@@ -158,6 +163,12 @@ asmlinkage long sys_litmus_unlock(int lock_od) | |||
158 | sched_trace_lock(current, l->ident, 0); | 163 | sched_trace_lock(current, l->ident, 0); |
159 | 164 | ||
160 | TRACE_CUR("Unlocked %d\n", l->ident); | 165 | TRACE_CUR("Unlocked %d\n", l->ident); |
166 | |||
167 | if (tsk_rt(current)->outermost_lock == l) { | ||
168 | TRACE_CUR("Lock %d assumed to be outermost lock.\n", l->ident); | ||
169 | tsk_rt(current)->outermost_lock = NULL; | ||
170 | WARN_ON(holds_locks(current)); | ||
171 | } | ||
161 | } | 172 | } |
162 | } | 173 | } |
163 | 174 | ||
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c index 1bfdef17e519..7178b6cd3ba1 100644 --- a/litmus/sched_cedf.c +++ b/litmus/sched_cedf.c | |||
@@ -803,9 +803,7 @@ static enum hrtimer_restart cedf_sobliv_on_exhausted(struct task_struct *t) | |||
803 | } | 803 | } |
804 | } | 804 | } |
805 | } | 805 | } |
806 | #endif | ||
807 | 806 | ||
808 | #ifdef CONFIG_LITMUS_LOCKING | ||
809 | /* Check our inheritance and propagate any changes forward. */ | 807 | /* Check our inheritance and propagate any changes forward. */ |
810 | sobliv_revaluate_task(t); | 808 | sobliv_revaluate_task(t); |
811 | #endif | 809 | #endif |