From: Nathan Lynch <ntl@pobox.com>

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: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/init/main.c    |    4 ++++
 25-akpm/kernel/sched.c |    1 +
 2 files changed, 5 insertions(+)

diff -puN init/main.c~explicitly-bind-idle-tasks init/main.c
--- 25/init/main.c~explicitly-bind-idle-tasks	2005-03-02 17:13:33.000000000 -0800
+++ 25-akpm/init/main.c	2005-03-02 17:13:34.000000000 -0800
@@ -635,6 +635,10 @@ static int init(void * unused)
 {
 	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
 	 * reaper of innocent orphaned children.
 	 *
diff -puN kernel/sched.c~explicitly-bind-idle-tasks kernel/sched.c
--- 25/kernel/sched.c~explicitly-bind-idle-tasks	2005-03-02 17:13:33.000000000 -0800
+++ 25-akpm/kernel/sched.c	2005-03-02 17:13:34.000000000 -0800
@@ -4019,6 +4019,7 @@ void __devinit init_idle(task_t *idle, i
 	idle->array = NULL;
 	idle->prio = MAX_PRIO;
 	idle->state = TASK_RUNNING;
+	idle->cpus_allowed = cpumask_of_cpu(cpu);
 	set_task_cpu(idle, cpu);
 
 	spin_lock_irqsave(&rq->lock, flags);
_