Skip to content

Commit e80fb7e

Browse files
committed
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()
2 parents 624235c + f83f9ac commit e80fb7e

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

‎kernel/sched.c‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,23 +2514,18 @@ void sched_fork(struct task_struct *p, int clone_flags)
25142514

25152515
__sched_fork(p);
25162516

2517-
/*
2518-
* Make sure we do not leak PI boosting priority to the child.
2519-
*/
2520-
p->prio = current->normal_prio;
2521-
25222517
/*
25232518
* Revert to default priority/policy on fork if requested.
25242519
*/
25252520
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) {
25272522
p->policy = SCHED_NORMAL;
2528-
2529-
if (p->normal_prio < DEFAULT_PRIO)
2530-
p->prio = DEFAULT_PRIO;
2523+
p->normal_prio = p->static_prio;
2524+
}
25312525

25322526
if (PRIO_TO_NICE(p->static_prio) < 0) {
25332527
p->static_prio = NICE_TO_PRIO(0);
2528+
p->normal_prio = p->static_prio;
25342529
set_load_weight(p);
25352530
}
25362531

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

2539+
/*
2540+
* Make sure we do not leak PI boosting priority to the child.
2541+
*/
2542+
p->prio = current->normal_prio;
2543+
25442544
if (!rt_prio(p->prio))
25452545
p->sched_class = &fair_sched_class;
25462546

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

2584-
p->prio = effective_prio(p);
2585-
25862584
if (!p->sched_class->task_new || !current->se.on_rq) {
25872585
activate_task(rq, p, 0);
25882586
} else {

0 commit comments

Comments
 (0)