aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/litmus/litmus.h2
-rw-r--r--kernel/sched.c4
-rw-r--r--litmus/litmus.c22
3 files changed, 21 insertions, 7 deletions
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h
index f0d42b729126..2e9e292d2822 100644
--- a/include/litmus/litmus.h
+++ b/include/litmus/litmus.h
@@ -60,7 +60,7 @@ void litmus_exec(void);
60void exit_litmus(struct task_struct *dead_tsk); 60void exit_litmus(struct task_struct *dead_tsk);
61 61
62long litmus_admit_task(struct task_struct *tsk); 62long litmus_admit_task(struct task_struct *tsk);
63void litmus_exit_task(struct task_struct *tsk); 63void litmus_exit_task(struct task_struct *tsk, int free_mem);
64 64
65#define is_realtime(t) ((t)->policy == SCHED_LITMUS) 65#define is_realtime(t) ((t)->policy == SCHED_LITMUS)
66#define rt_transition_pending(t) \ 66#define rt_transition_pending(t) \
diff --git a/kernel/sched.c b/kernel/sched.c
index 0166daa4a374..5969c8b25689 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -905,7 +905,7 @@ static __read_mostly int scheduler_running;
905 * 905 *
906 * Litmus RT: with the Preempt-RT patch we rely on rt-threads 906 * Litmus RT: with the Preempt-RT patch we rely on rt-threads
907 * to set timers. If the RT throttling gets activated we experience 907 * to set timers. If the RT throttling gets activated we experience
908 * very long latencies. Change from 950000 to -1 -> RUNTIME_INF 908 * very long latencies. Change from 950000 to -1 -> RUNTIME_INF
909 */ 909 */
910int sysctl_sched_rt_runtime = -1; 910int sysctl_sched_rt_runtime = -1;
911 911
@@ -6805,7 +6805,7 @@ recheck:
6805 p->sched_reset_on_fork = reset_on_fork; 6805 p->sched_reset_on_fork = reset_on_fork;
6806 6806
6807 if (p->policy == SCHED_LITMUS) 6807 if (p->policy == SCHED_LITMUS)
6808 litmus_exit_task(p); 6808 litmus_exit_task(p, 0);
6809 6809
6810 oldprio = p->prio; 6810 oldprio = p->prio;
6811 prev_class = p->sched_class; 6811 prev_class = p->sched_class;
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
389void litmus_exit_task(struct task_struct* tsk) 389void 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