lkml.org 
[lkml]   [2011]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH 11/19] OpenRISC: Idle/Power management
    Date
    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


    \
     
     \ /
      Last update: 2011-06-20 10:23    [W:0.022 / U:119.640 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site