diff options
Diffstat (limited to 'litmus/litmus.c')
-rw-r--r-- | litmus/litmus.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c index 447f8e8af04d..fc63e6dee84a 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c | |||
@@ -386,7 +386,7 @@ out: | |||
386 | return retval; | 386 | return retval; |
387 | } | 387 | } |
388 | 388 | ||
389 | void litmus_exit_task(struct task_struct* tsk) | 389 | void litmus_exit_task(struct task_struct* tsk, int free_mem) |
390 | { | 390 | { |
391 | if (is_realtime(tsk)) { | 391 | if (is_realtime(tsk)) { |
392 | sched_trace_task_completion(tsk, 1); | 392 | sched_trace_task_completion(tsk, 1); |
@@ -394,8 +394,22 @@ void litmus_exit_task(struct task_struct* tsk) | |||
394 | litmus->task_exit(tsk); | 394 | litmus->task_exit(tsk); |
395 | 395 | ||
396 | BUG_ON(bheap_node_in_heap(tsk_rt(tsk)->heap_node)); | 396 | BUG_ON(bheap_node_in_heap(tsk_rt(tsk)->heap_node)); |
397 | bheap_node_free(tsk_rt(tsk)->heap_node); | 397 | if (free_mem) { |
398 | release_heap_free(tsk_rt(tsk)->rel_heap); | 398 | bheap_node_free(tsk_rt(tsk)->heap_node); |
399 | release_heap_free(tsk_rt(tsk)->rel_heap); | ||
400 | } else { | ||
401 | /* XXX: in PreemptRT calling kfree here will deadlock | ||
402 | * postponing the free when the rq->lock and the | ||
403 | * pi_lock are released don't work (it breaks | ||
404 | * other assumptions in the code). This is ugly, | ||
405 | * but for now we leak memory. To avoid the leakage | ||
406 | * the user should not reset the state of a litmus | ||
407 | * task to a background task. | ||
408 | */ | ||
409 | tsk_rt(tsk)->heap_node = NULL; | ||
410 | hrtimer_cancel(&(tsk_rt(tsk)->rel_heap)->timer); | ||
411 | tsk_rt(tsk)->rel_heap = NULL; | ||
412 | } | ||
399 | 413 | ||
400 | atomic_dec(&rt_task_count); | 414 | atomic_dec(&rt_task_count); |
401 | reinit_litmus_state(tsk, 1); | 415 | reinit_litmus_state(tsk, 1); |
@@ -500,7 +514,7 @@ void exit_litmus(struct task_struct *dead_tsk) | |||
500 | 514 | ||
501 | /* main cleanup only for RT tasks */ | 515 | /* main cleanup only for RT tasks */ |
502 | if (is_realtime(dead_tsk)) | 516 | if (is_realtime(dead_tsk)) |
503 | litmus_exit_task(dead_tsk); | 517 | litmus_exit_task(dead_tsk, 1); |
504 | } | 518 | } |
505 | 519 | ||
506 | 520 | ||