mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
sched: Clean up SCHED_RESET_ON_FORK
Make SCHED_RESET_ON_FORK sched_fork() bits a self-contained unlikely code path. Signed-off-by: Mike Galbraith <efault@gmx.de> Acked-by: Lennart Poettering <mzxreary@0pointer.de> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <1245228361.18329.6.camel@marge.simson.net> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
ca94c44253
commit
b9dc29e72f
1 changed files with 18 additions and 16 deletions
|
@ -2613,28 +2613,30 @@ 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))
|
|
||||||
p->policy = SCHED_NORMAL;
|
|
||||||
|
|
||||||
if (current->sched_reset_on_fork &&
|
/*
|
||||||
(current->normal_prio < DEFAULT_PRIO))
|
* Revert to default priority/policy on fork if requested.
|
||||||
p->prio = DEFAULT_PRIO;
|
*/
|
||||||
else
|
if (unlikely(p->sched_reset_on_fork)) {
|
||||||
p->prio = current->normal_prio;
|
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))
|
if (!rt_prio(p->prio))
|
||||||
p->sched_class = &fair_sched_class;
|
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 defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
|
||||||
if (likely(sched_info_on()))
|
if (likely(sched_info_on()))
|
||||||
memset(&p->sched_info, 0, sizeof(p->sched_info));
|
memset(&p->sched_info, 0, sizeof(p->sched_info));
|
||||||
|
|
Loading…
Reference in a new issue