sched: fix init_idle()'s use of sched_clock()

Maciej Rutecki reported:

> I have this bug during suspend to disk:
>
> [ 188.592151] Enabling non-boot CPUs ...
> [ 188.592151] SMP alternatives: switching to SMP code
> [ 188.666058] BUG: using smp_processor_id() in preemptible
> [00000000]
> code: suspend_to_disk/2934
> [ 188.666064] caller is native_sched_clock+0x2b/0x80

Which, as noted by Linus, was caused by me, via:

7cbaef9c "sched: optimize sched_clock() a bit"

Move the rq locking a bit earlier in the initialization sequence,
that will make the sched_clock() call in init_idle() non-preemptible.

Reported-by: Maciej Rutecki <maciej.rutecki@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

+2 -1
+2 -1
kernel/sched.c
··· 5870 5870 struct rq *rq = cpu_rq(cpu); 5871 5871 unsigned long flags; 5872 5872 5873 + spin_lock_irqsave(&rq->lock, flags); 5874 + 5873 5875 __sched_fork(idle); 5874 5876 idle->se.exec_start = sched_clock(); 5875 5877 ··· 5879 5877 idle->cpus_allowed = cpumask_of_cpu(cpu); 5880 5878 __set_task_cpu(idle, cpu); 5881 5879 5882 - spin_lock_irqsave(&rq->lock, flags); 5883 5880 rq->curr = rq->idle = idle; 5884 5881 #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) 5885 5882 idle->oncpu = 1;