- time stops if there is no activity and the timer expired before
we halted the cpu
- restart_local_timer() checks if the timer has expired and if so it
restarts it
- we do the same when switching back to userspace
switch_address_space_idle();
#ifdef CONFIG_SMP
+ get_cpulocal_var(cpu_is_idle) = 1;
/* we don't need to keep time on APs as it is handled on the BSP */
if (cpuid != bsp_cpu_id)
stop_local_timer();
- get_cpulocal_var(cpu_is_idle) = 1;
+ else
#endif
+ {
+ /*
+ * If the timer has expired while in kernel we must
+ * rearm it before we go to sleep
+ */
+ restart_local_timer();
+ }
/* start accounting for the idle time */
context_stop(proc_addr(KERNEL));