diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-08 15:07:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-08 15:07:24 -0400 |
commit | e80fb7e52fd305b916a671755ca31ecf8f92e94e (patch) | |
tree | 476b8d77b6c59a3da6c6e7c30958b9912a904944 | |
parent | 624235c5b3a62639136b7823c2c88e4aeb5c5a8d (diff) | |
parent | f83f9ac2632732bd1678150b5a03d152f912fe72 (diff) |
Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
sched: Set correct normal_prio and prio values in sched_fork()
-rw-r--r-- | kernel/sched.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 1535f3884b88..76c0e9691fc0 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2515,22 +2515,17 @@ void sched_fork(struct task_struct *p, int clone_flags) | |||
2515 | __sched_fork(p); | 2515 | __sched_fork(p); |
2516 | 2516 | ||
2517 | /* | 2517 | /* |
2518 | * Make sure we do not leak PI boosting priority to the child. | ||
2519 | */ | ||
2520 | p->prio = current->normal_prio; | ||
2521 | |||
2522 | /* | ||
2523 | * Revert to default priority/policy on fork if requested. | 2518 | * Revert to default priority/policy on fork if requested. |
2524 | */ | 2519 | */ |
2525 | if (unlikely(p->sched_reset_on_fork)) { | 2520 | if (unlikely(p->sched_reset_on_fork)) { |
2526 | if (p->policy == SCHED_FIFO || p->policy == SCHED_RR) | 2521 | if (p->policy == SCHED_FIFO || p->policy == SCHED_RR) { |
2527 | p->policy = SCHED_NORMAL; | 2522 | p->policy = SCHED_NORMAL; |
2528 | 2523 | p->normal_prio = p->static_prio; | |
2529 | if (p->normal_prio < DEFAULT_PRIO) | 2524 | } |
2530 | p->prio = DEFAULT_PRIO; | ||
2531 | 2525 | ||
2532 | if (PRIO_TO_NICE(p->static_prio) < 0) { | 2526 | if (PRIO_TO_NICE(p->static_prio) < 0) { |
2533 | p->static_prio = NICE_TO_PRIO(0); | 2527 | p->static_prio = NICE_TO_PRIO(0); |
2528 | p->normal_prio = p->static_prio; | ||
2534 | set_load_weight(p); | 2529 | set_load_weight(p); |
2535 | } | 2530 | } |
2536 | 2531 | ||
@@ -2541,6 +2536,11 @@ void sched_fork(struct task_struct *p, int clone_flags) | |||
2541 | p->sched_reset_on_fork = 0; | 2536 | p->sched_reset_on_fork = 0; |
2542 | } | 2537 | } |
2543 | 2538 | ||
2539 | /* | ||
2540 | * Make sure we do not leak PI boosting priority to the child. | ||
2541 | */ | ||
2542 | p->prio = current->normal_prio; | ||
2543 | |||
2544 | if (!rt_prio(p->prio)) | 2544 | if (!rt_prio(p->prio)) |
2545 | p->sched_class = &fair_sched_class; | 2545 | p->sched_class = &fair_sched_class; |
2546 | 2546 | ||
@@ -2581,8 +2581,6 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags) | |||
2581 | BUG_ON(p->state != TASK_RUNNING); | 2581 | BUG_ON(p->state != TASK_RUNNING); |
2582 | update_rq_clock(rq); | 2582 | update_rq_clock(rq); |
2583 | 2583 | ||
2584 | p->prio = effective_prio(p); | ||
2585 | |||
2586 | if (!p->sched_class->task_new || !current->se.on_rq) { | 2584 | if (!p->sched_class->task_new || !current->se.on_rq) { |
2587 | activate_task(rq, p, 0); | 2585 | activate_task(rq, p, 0); |
2588 | } else { | 2586 | } else { |