Commit 1e0b6385 authored by Nathan T. Lynch's avatar Nathan T. Lynch Committed by Linus Torvalds

[PATCH] explicitly bind idle tasks

With hotplug cpu and preempt, we tend to see smp_processor_id warnings from
idle loop code because it's always checking whether its cpu has gone
offline.  Replacing every use of smp_processor_id with _smp_processor_id in
all idle loop code is one solution; another way is explicitly binding idle
threads to their cpus (the smp_processor_id warning does not fire if the
caller is bound only to the calling cpu).  This has the (admittedly slight)
advantage of letting us know if an idle thread ever runs on the wrong cpu.
Signed-off-by: default avatarNathan Lynch <ntl@pobox.com>
Acked-by: default avatarJoel Schopp <jschopp@austin.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 909c3178
...@@ -633,6 +633,10 @@ static inline void fixup_cpu_present_map(void) ...@@ -633,6 +633,10 @@ static inline void fixup_cpu_present_map(void)
static int init(void * unused) static int init(void * unused)
{ {
lock_kernel(); lock_kernel();
/*
* init can run on any cpu.
*/
set_cpus_allowed(current, CPU_MASK_ALL);
/* /*
* Tell the world that we're going to be the grim * Tell the world that we're going to be the grim
* reaper of innocent orphaned children. * reaper of innocent orphaned children.
......
...@@ -4063,6 +4063,7 @@ void __devinit init_idle(task_t *idle, int cpu) ...@@ -4063,6 +4063,7 @@ void __devinit init_idle(task_t *idle, int cpu)
idle->array = NULL; idle->array = NULL;
idle->prio = MAX_PRIO; idle->prio = MAX_PRIO;
idle->state = TASK_RUNNING; idle->state = TASK_RUNNING;
idle->cpus_allowed = cpumask_of_cpu(cpu);
set_task_cpu(idle, cpu); set_task_cpu(idle, cpu);
spin_lock_irqsave(&rq->lock, flags); spin_lock_irqsave(&rq->lock, flags);
......
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