aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2f9c92884817..615953141951 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4934,7 +4934,15 @@ void init_idle(struct task_struct *idle, int cpu)
4934 idle->state = TASK_RUNNING; 4934 idle->state = TASK_RUNNING;
4935 idle->se.exec_start = sched_clock(); 4935 idle->se.exec_start = sched_clock();
4936 4936
4937 do_set_cpus_allowed(idle, cpumask_of(cpu)); 4937#ifdef CONFIG_SMP
4938 /*
4939 * Its possible that init_idle() gets called multiple times on a task,
4940 * in that case do_set_cpus_allowed() will not do the right thing.
4941 *
4942 * And since this is boot we can forgo the serialization.
4943 */
4944 set_cpus_allowed_common(idle, cpumask_of(cpu));
4945#endif
4938 /* 4946 /*
4939 * We're having a chicken and egg problem, even though we are 4947 * We're having a chicken and egg problem, even though we are
4940 * holding rq->lock, the cpu isn't yet set to this cpu so the 4948 * holding rq->lock, the cpu isn't yet set to this cpu so the
@@ -4951,7 +4959,7 @@ void init_idle(struct task_struct *idle, int cpu)
4951 4959
4952 rq->curr = rq->idle = idle; 4960 rq->curr = rq->idle = idle;
4953 idle->on_rq = TASK_ON_RQ_QUEUED; 4961 idle->on_rq = TASK_ON_RQ_QUEUED;
4954#if defined(CONFIG_SMP) 4962#ifdef CONFIG_SMP
4955 idle->on_cpu = 1; 4963 idle->on_cpu = 1;
4956#endif 4964#endif
4957 raw_spin_unlock(&rq->lock); 4965 raw_spin_unlock(&rq->lock);
@@ -4966,7 +4974,7 @@ void init_idle(struct task_struct *idle, int cpu)
4966 idle->sched_class = &idle_sched_class; 4974 idle->sched_class = &idle_sched_class;
4967 ftrace_graph_init_idle_task(idle, cpu); 4975 ftrace_graph_init_idle_task(idle, cpu);
4968 vtime_init_idle(idle, cpu); 4976 vtime_init_idle(idle, cpu);
4969#if defined(CONFIG_SMP) 4977#ifdef CONFIG_SMP
4970 sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu); 4978 sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);
4971#endif 4979#endif
4972} 4980}