diff options
author | Mike Galbraith <efault@gmx.de> | 2009-06-17 04:46:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-17 12:34:17 -0400 |
commit | b9dc29e72fd3dc2a739ce8eafd958220d0745734 (patch) | |
tree | 4d9c9130be87a7a876dd623a4ca8891b1232ae41 /kernel | |
parent | ca94c442535a44d508c99a77e54f21a59f4fc462 (diff) |
sched: Clean up SCHED_RESET_ON_FORK
Make SCHED_RESET_ON_FORK sched_fork() bits a self-contained unlikely code path.
Signed-off-by: Mike Galbraith <efault@gmx.de>
Acked-by: Lennart Poettering <mzxreary@0pointer.de>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1245228361.18329.6.camel@marge.simson.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 32e6ede85255..50e4e3d15e83 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2613,28 +2613,30 @@ void sched_fork(struct task_struct *p, int clone_flags) | |||
2613 | set_task_cpu(p, cpu); | 2613 | set_task_cpu(p, cpu); |
2614 | 2614 | ||
2615 | /* | 2615 | /* |
2616 | * Revert to default priority/policy on fork if requested. Make sure we | 2616 | * Make sure we do not leak PI boosting priority to the child. |
2617 | * do not leak PI boosting priority to the child. | ||
2618 | */ | 2617 | */ |
2619 | if (current->sched_reset_on_fork && | 2618 | p->prio = current->normal_prio; |
2620 | (p->policy == SCHED_FIFO || p->policy == SCHED_RR)) | ||
2621 | p->policy = SCHED_NORMAL; | ||
2622 | 2619 | ||
2623 | if (current->sched_reset_on_fork && | 2620 | /* |
2624 | (current->normal_prio < DEFAULT_PRIO)) | 2621 | * Revert to default priority/policy on fork if requested. |
2625 | p->prio = DEFAULT_PRIO; | 2622 | */ |
2626 | else | 2623 | if (unlikely(p->sched_reset_on_fork)) { |
2627 | p->prio = current->normal_prio; | 2624 | if (p->policy == SCHED_FIFO || p->policy == SCHED_RR) |
2625 | p->policy = SCHED_NORMAL; | ||
2626 | |||
2627 | if (p->normal_prio < DEFAULT_PRIO) | ||
2628 | p->prio = DEFAULT_PRIO; | ||
2629 | |||
2630 | /* | ||
2631 | * We don't need the reset flag anymore after the fork. It has | ||
2632 | * fulfilled its duty: | ||
2633 | */ | ||
2634 | p->sched_reset_on_fork = 0; | ||
2635 | } | ||
2628 | 2636 | ||
2629 | if (!rt_prio(p->prio)) | 2637 | if (!rt_prio(p->prio)) |
2630 | p->sched_class = &fair_sched_class; | 2638 | p->sched_class = &fair_sched_class; |
2631 | 2639 | ||
2632 | /* | ||
2633 | * We don't need the reset flag anymore after the fork. It has | ||
2634 | * fulfilled its duty: | ||
2635 | */ | ||
2636 | p->sched_reset_on_fork = 0; | ||
2637 | |||
2638 | #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) | 2640 | #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) |
2639 | if (likely(sched_info_on())) | 2641 | if (likely(sched_info_on())) |
2640 | memset(&p->sched_info, 0, sizeof(p->sched_info)); | 2642 | memset(&p->sched_info, 0, sizeof(p->sched_info)); |