diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-01-29 20:31:57 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-01-30 14:31:56 -0500 |
commit | 904531a6321964579ab0972a8833616e97dbf582 (patch) | |
tree | 98c382e81f1d449ceab4e1941771adc1666558f6 | |
parent | 3d8eb93db513bd9caa982f27fee8156405fac754 (diff) |
bugfix: don't let children stay Litmus real-time tasks
It has always been LITMUS^RT policy that children of real-time tasks
may not skip the admissions test, etc. This used to be enforced, but
was apparently dropped during some port. This commit re-introduces
this policy. This fixes a kernel panic that occurred when "real-time
children" exited without proper initilization.
-rw-r--r-- | kernel/sched.c | 3 | ||||
-rw-r--r-- | litmus/litmus.c | 9 |
2 files changed, 6 insertions, 6 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 1b13c8e1cfc2..5beefb2e7970 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2557,7 +2557,8 @@ void sched_fork(struct task_struct *p, int clone_flags) | |||
2557 | * Revert to default priority/policy on fork if requested. | 2557 | * Revert to default priority/policy on fork if requested. |
2558 | */ | 2558 | */ |
2559 | if (unlikely(p->sched_reset_on_fork)) { | 2559 | if (unlikely(p->sched_reset_on_fork)) { |
2560 | if (p->policy == SCHED_FIFO || p->policy == SCHED_RR) { | 2560 | if (p->policy == SCHED_FIFO || p->policy == SCHED_RR || |
2561 | p->policy == SCHED_LITMUS) { | ||
2561 | p->policy = SCHED_NORMAL; | 2562 | p->policy = SCHED_NORMAL; |
2562 | p->normal_prio = p->static_prio; | 2563 | p->normal_prio = p->static_prio; |
2563 | } | 2564 | } |
diff --git a/litmus/litmus.c b/litmus/litmus.c index 8efd3f9ef7ee..11ccaafd50de 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c | |||
@@ -292,9 +292,6 @@ static void reinit_litmus_state(struct task_struct* p, int restore) | |||
292 | */ | 292 | */ |
293 | WARN_ON(p->rt_param.inh_task); | 293 | WARN_ON(p->rt_param.inh_task); |
294 | 294 | ||
295 | /* We need to restore the priority of the task. */ | ||
296 | // __setscheduler(p, p->rt_param.old_policy, p->rt_param.old_prio); XXX why is this commented? | ||
297 | |||
298 | /* Cleanup everything else. */ | 295 | /* Cleanup everything else. */ |
299 | memset(&p->rt_param, 0, sizeof(p->rt_param)); | 296 | memset(&p->rt_param, 0, sizeof(p->rt_param)); |
300 | 297 | ||
@@ -437,10 +434,12 @@ out: | |||
437 | */ | 434 | */ |
438 | void litmus_fork(struct task_struct* p) | 435 | void litmus_fork(struct task_struct* p) |
439 | { | 436 | { |
440 | if (is_realtime(p)) | 437 | if (is_realtime(p)) { |
441 | /* clean out any litmus related state, don't preserve anything */ | 438 | /* clean out any litmus related state, don't preserve anything */ |
442 | reinit_litmus_state(p, 0); | 439 | reinit_litmus_state(p, 0); |
443 | else | 440 | /* Don't let the child be a real-time task. */ |
441 | p->sched_reset_on_fork = 1; | ||
442 | } else | ||
444 | /* non-rt tasks might have ctrl_page set */ | 443 | /* non-rt tasks might have ctrl_page set */ |
445 | tsk_rt(p)->ctrl_page = NULL; | 444 | tsk_rt(p)->ctrl_page = NULL; |
446 | 445 | ||