Commit b9dc29e7 authored by Mike Galbraith's avatar Mike Galbraith Committed by Ingo Molnar

sched: Clean up SCHED_RESET_ON_FORK

Make SCHED_RESET_ON_FORK sched_fork() bits a self-contained unlikely code path.
Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
Acked-by: default avatarLennart Poettering <mzxreary@0pointer.de>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1245228361.18329.6.camel@marge.simson.net>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent ca94c442
...@@ -2613,27 +2613,29 @@ void sched_fork(struct task_struct *p, int clone_flags) ...@@ -2613,27 +2613,29 @@ void sched_fork(struct task_struct *p, int clone_flags)
set_task_cpu(p, cpu); set_task_cpu(p, cpu);
/* /*
* Revert to default priority/policy on fork if requested. Make sure we * Make sure we do not leak PI boosting priority to the child.
* do not leak PI boosting priority to the child.
*/ */
if (current->sched_reset_on_fork && p->prio = current->normal_prio;
(p->policy == SCHED_FIFO || p->policy == SCHED_RR))
/*
* 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)
p->policy = SCHED_NORMAL; p->policy = SCHED_NORMAL;
if (current->sched_reset_on_fork && if (p->normal_prio < DEFAULT_PRIO)
(current->normal_prio < DEFAULT_PRIO))
p->prio = DEFAULT_PRIO; p->prio = DEFAULT_PRIO;
else
p->prio = current->normal_prio;
if (!rt_prio(p->prio))
p->sched_class = &fair_sched_class;
/* /*
* We don't need the reset flag anymore after the fork. It has * We don't need the reset flag anymore after the fork. It has
* fulfilled its duty: * fulfilled its duty:
*/ */
p->sched_reset_on_fork = 0; p->sched_reset_on_fork = 0;
}
if (!rt_prio(p->prio))
p->sched_class = &fair_sched_class;
#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
if (likely(sched_info_on())) if (likely(sched_info_on()))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment