aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 32e6ede85255..50e4e3d15e83 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2613,28 +2613,30 @@ void sched_fork(struct task_struct *p, int clone_flags)
2613 set_task_cpu(p, cpu); 2613 set_task_cpu(p, cpu);
2614 2614
2615 /* 2615 /*
2616 * Revert to default priority/policy on fork if requested. Make sure we 2616 * Make sure we do not leak PI boosting priority to the child.
2617 * do not leak PI boosting priority to the child.
2618 */ 2617 */
2619 if (current->sched_reset_on_fork && 2618 p->prio = current->normal_prio;
2620 (p->policy == SCHED_FIFO || p->policy == SCHED_RR))
2621 p->policy = SCHED_NORMAL;
2622 2619
2623 if (current->sched_reset_on_fork && 2620 /*
2624 (current->normal_prio < DEFAULT_PRIO)) 2621 * Revert to default priority/policy on fork if requested.
2625 p->prio = DEFAULT_PRIO; 2622 */
2626 else 2623 if (unlikely(p->sched_reset_on_fork)) {
2627 p->prio = current->normal_prio; 2624 if (p->policy == SCHED_FIFO || p->policy == SCHED_RR)
2625 p->policy = SCHED_NORMAL;
2626
2627 if (p->normal_prio < DEFAULT_PRIO)
2628 p->prio = DEFAULT_PRIO;
2629
2630 /*
2631 * We don't need the reset flag anymore after the fork. It has
2632 * fulfilled its duty:
2633 */
2634 p->sched_reset_on_fork = 0;
2635 }
2628 2636
2629 if (!rt_prio(p->prio)) 2637 if (!rt_prio(p->prio))
2630 p->sched_class = &fair_sched_class; 2638 p->sched_class = &fair_sched_class;
2631 2639
2632 /*
2633 * We don't need the reset flag anymore after the fork. It has
2634 * fulfilled its duty:
2635 */
2636 p->sched_reset_on_fork = 0;
2637
2638#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 2640#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
2639 if (likely(sched_info_on())) 2641 if (likely(sched_info_on()))
2640 memset(&p->sched_info, 0, sizeof(p->sched_info)); 2642 memset(&p->sched_info, 0, sizeof(p->sched_info));