Messages in this thread | | | From | Arnd Bergmann <> | Subject | Re: [PATCH 11/19] OpenRISC: Idle/Power management | Date | Mon, 20 Jun 2011 10:20:39 +0200 |
| |
On Sunday 19 June 2011 13:43:37 Jonas Bonn wrote: > +void cpu_idle(void) > +{ > + unsigned int cpu = smp_processor_id(); > + > + set_thread_flag(TIF_POLLING_NRFLAG); > + > + /* endless idle loop with no priority at all */ > + while (1) { > + tick_nohz_stop_sched_tick(1); > + > + while (!need_resched()) { > + check_pgt_cache(); > + rmb(); > + > +/* if (cpu_is_offline(cpu)) > + play_dead(); > +*/ > + clear_thread_flag(TIF_POLLING_NRFLAG); > + > + local_irq_disable(); > + /* Don't trace irqs off for idle */ > + stop_critical_timings(); > + if (powersave != NULL ) > + powersave(); > + start_critical_timings(); > + local_irq_enable(); > + set_thread_flag(TIF_POLLING_NRFLAG); > + } > + > + tick_nohz_restart_sched_tick(); > + preempt_enable_no_resched(); > + schedule(); > + preempt_disable(); > + }
Shouldn't you check need_resched() inside of local_irq_disable? Otherwise you may get interrupted between the check at the start of the loop and the irq_disable, which tries to wake up another process just before you go to sleep indefinitely.
Arnd
| |