diff options
Diffstat (limited to 'litmus/sched_cedf.c')
-rw-r--r-- | litmus/sched_cedf.c | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c index 61fef55f38a5..760fb4269e00 100644 --- a/litmus/sched_cedf.c +++ b/litmus/sched_cedf.c | |||
@@ -258,44 +258,53 @@ static void cedf_untrack_in_top_m(struct task_struct *t) | |||
258 | { | 258 | { |
259 | /* cluster lock must be held */ | 259 | /* cluster lock must be held */ |
260 | cedf_domain_t *cluster = task_cpu_cluster(t); | 260 | cedf_domain_t *cluster = task_cpu_cluster(t); |
261 | int exited_top_m = 0; | ||
261 | 262 | ||
262 | if (!sbinheap_is_in_heap(&tsk_rt(t)->budget.top_m_node) && | 263 | BUG_ON(sbinheap_is_in_heap(&tsk_rt(t)->budget.top_m_node) && |
263 | !binheap_is_in_heap(&tsk_rt(t)->budget.not_top_m_node)) | 264 | binheap_is_in_heap(&tsk_rt(t)->budget.not_top_m_node)); |
264 | return; | 265 | |
266 | if (sbinheap_is_in_heap(&tsk_rt(t)->budget.top_m_node)) { | ||
267 | exited_top_m = bt_flag_is_set(t, BTF_IS_TOP_M); | ||
268 | WARN_ON_ONCE(!exited_top_m); | ||
265 | 269 | ||
266 | if (bt_flag_is_set(t, BTF_IS_TOP_M)) { | ||
267 | /* delete t's entry */ | ||
268 | sbinheap_delete(&tsk_rt(t)->budget.top_m_node, &cluster->top_m); | 270 | sbinheap_delete(&tsk_rt(t)->budget.top_m_node, &cluster->top_m); |
269 | INIT_SBINHEAP_NODE(&tsk_rt(t)->budget.top_m_node); | 271 | INIT_SBINHEAP_NODE(&tsk_rt(t)->budget.top_m_node); |
270 | budget_state_machine(t,on_exit_top_m); | ||
271 | bt_flag_clear(t, BTF_IS_TOP_M); | ||
272 | 272 | ||
273 | /* move a task over from the overflow heap */ | 273 | if (likely(exited_top_m)) { |
274 | if(!binheap_empty(&cluster->not_top_m)) { | 274 | budget_state_machine(t,on_exit_top_m); |
275 | struct budget_tracker *bt = | 275 | bt_flag_clear(t, BTF_IS_TOP_M); |
276 | binheap_top_entry(&cluster->not_top_m, struct budget_tracker, | ||
277 | not_top_m_node); | ||
278 | struct task_struct *to_move = | ||
279 | container_of( | ||
280 | container_of(bt, struct rt_param, budget), | ||
281 | struct task_struct, | ||
282 | rt_param); | ||
283 | |||
284 | binheap_delete_root(&cluster->not_top_m, struct budget_tracker, | ||
285 | not_top_m_node); | ||
286 | INIT_BINHEAP_NODE(&tsk_rt(to_move)->budget.not_top_m_node); | ||
287 | |||
288 | sbinheap_add(&tsk_rt(to_move)->budget.top_m_node, | ||
289 | &cluster->top_m, | ||
290 | struct budget_tracker, top_m_node); | ||
291 | bt_flag_set(to_move, BTF_IS_TOP_M); | ||
292 | budget_state_machine(to_move,on_enter_top_m); | ||
293 | } | 276 | } |
294 | } | 277 | } |
295 | else { | 278 | else if(likely(binheap_is_in_heap(&tsk_rt(t)->budget.not_top_m_node))) { |
296 | binheap_delete(&tsk_rt(t)->budget.not_top_m_node, &cluster->not_top_m); | 279 | binheap_delete(&tsk_rt(t)->budget.not_top_m_node, &cluster->not_top_m); |
297 | INIT_BINHEAP_NODE(&tsk_rt(t)->budget.not_top_m_node); | 280 | INIT_BINHEAP_NODE(&tsk_rt(t)->budget.not_top_m_node); |
298 | } | 281 | } |
282 | |||
283 | /* move a task over from the overflow heap */ | ||
284 | if(!sbinheap_full(&cluster->top_m) && | ||
285 | !binheap_empty(&cluster->not_top_m)) { | ||
286 | struct budget_tracker *bt = | ||
287 | binheap_top_entry(&cluster->not_top_m, struct budget_tracker, | ||
288 | not_top_m_node); | ||
289 | struct task_struct *to_move = | ||
290 | container_of( | ||
291 | container_of(bt, struct rt_param, budget), | ||
292 | struct task_struct, | ||
293 | rt_param); | ||
294 | |||
295 | /* task should have already been moved into the top m */ | ||
296 | WARN_ON_ONCE(!exited_top_m); | ||
297 | |||
298 | binheap_delete_root(&cluster->not_top_m, struct budget_tracker, | ||
299 | not_top_m_node); | ||
300 | INIT_BINHEAP_NODE(&tsk_rt(to_move)->budget.not_top_m_node); | ||
301 | |||
302 | sbinheap_add(&tsk_rt(to_move)->budget.top_m_node, | ||
303 | &cluster->top_m, | ||
304 | struct budget_tracker, top_m_node); | ||
305 | bt_flag_set(to_move, BTF_IS_TOP_M); | ||
306 | budget_state_machine(to_move,on_enter_top_m); | ||
307 | } | ||
299 | } | 308 | } |
300 | 309 | ||
301 | 310 | ||