sched: enable early use of sched_clock()

some platforms have sched_clock() implementations that cannot be called
very early during wakeup. If it's called it might hang or crash in hard
to debug ways. So only call update_rq_clock() [which calls sched_clock()]
if sched_init() has already been called. (rq->idle is NULL before the
scheduler is initialized.)

Signed-off-by: Ingo Molnar <mingo@elte.hu>

+6 -1
+6 -1
kernel/sched.c
··· 488 488 489 489 local_irq_save(flags); 490 490 rq = cpu_rq(cpu); 491 - update_rq_clock(rq); 491 + /* 492 + * Only call sched_clock() if the scheduler has already been 493 + * initialized (some code might call cpu_clock() very early): 494 + */ 495 + if (rq->idle) 496 + update_rq_clock(rq); 492 497 now = rq->clock; 493 498 local_irq_restore(flags); 494 499