提交 b9dc29e7 编写于 作者: M Mike Galbraith 提交者: 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: NMike Galbraith <efault@gmx.de>
Acked-by: NLennart Poettering <mzxreary@0pointer.de>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1245228361.18329.6.camel@marge.simson.net>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 ca94c442
......@@ -2613,28 +2613,30 @@ void sched_fork(struct task_struct *p, int clone_flags)
set_task_cpu(p, cpu);
/*
* Revert to default priority/policy on fork if requested. Make sure we
* do not leak PI boosting priority to the child.
* Make sure we do not leak PI boosting priority to the child.
*/
if (current->sched_reset_on_fork &&
(p->policy == SCHED_FIFO || p->policy == SCHED_RR))
p->policy = SCHED_NORMAL;
p->prio = current->normal_prio;
if (current->sched_reset_on_fork &&
(current->normal_prio < DEFAULT_PRIO))
p->prio = DEFAULT_PRIO;
else
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)
p->policy = SCHED_NORMAL;
if (p->normal_prio < DEFAULT_PRIO)
p->prio = DEFAULT_PRIO;
/*
* We don't need the reset flag anymore after the fork. It has
* fulfilled its duty:
*/
p->sched_reset_on_fork = 0;
}
if (!rt_prio(p->prio))
p->sched_class = &fair_sched_class;
/*
* We don't need the reset flag anymore after the fork. It has
* fulfilled its duty:
*/
p->sched_reset_on_fork = 0;
#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
if (likely(sched_info_on()))
memset(&p->sched_info, 0, sizeof(p->sched_info));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册