Skip to content

Commit

Permalink
Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…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()
  • Loading branch information
torvalds committed Oct 8, 2009
2 parents 624235c + f83f9ac commit e80fb7e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -2514,23 +2514,18 @@ void sched_fork(struct task_struct *p, int clone_flags)

__sched_fork(p);

/*
* Make sure we do not leak PI boosting priority to the child.
*/
p->prio = current->normal_prio;

/*
* Revert to default priority/policy on fork if requested.
*/
if (unlikely(p->sched_reset_on_fork)) {
if (p->policy == SCHED_FIFO || p->policy == SCHED_RR)
if (p->policy == SCHED_FIFO || p->policy == SCHED_RR) {
p->policy = SCHED_NORMAL;

if (p->normal_prio < DEFAULT_PRIO)
p->prio = DEFAULT_PRIO;
p->normal_prio = p->static_prio;
}

if (PRIO_TO_NICE(p->static_prio) < 0) {
p->static_prio = NICE_TO_PRIO(0);
p->normal_prio = p->static_prio;
set_load_weight(p);
}

Expand All @@ -2541,6 +2536,11 @@ void sched_fork(struct task_struct *p, int clone_flags)
p->sched_reset_on_fork = 0;
}

/*
* Make sure we do not leak PI boosting priority to the child.
*/
p->prio = current->normal_prio;

if (!rt_prio(p->prio))
p->sched_class = &fair_sched_class;

Expand Down Expand Up @@ -2581,8 +2581,6 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
BUG_ON(p->state != TASK_RUNNING);
update_rq_clock(rq);

p->prio = effective_prio(p);

if (!p->sched_class->task_new || !current->se.on_rq) {
activate_task(rq, p, 0);
} else {
Expand Down

0 comments on commit e80fb7e

Please sign in to comment.