Re: Warning in worker_enter_idle()

From: Tejun Heo
Date: Mon May 07 2012 - 15:40:43 EST


Hello, Paul.

On Sun, May 06, 2012 at 08:38:14AM -0700, Paul E. McKenney wrote:
> Hello!
>
> The worker_enter_idle() is complaining that there all workers are idle,
> but that there is work remaining:
>
> /* sanity check nr_running */
> WARN_ON_ONCE(gcwq->nr_workers == gcwq->nr_idle &&
> atomic_read(get_gcwq_nr_running(gcwq->cpu)));
>
> This is running on Power, .config attached. I must confess that I don't
> see any sort of synchronization or memory barriers that would keep the
> counts straight on a weakly ordered system. Or is there some clever
> design constraint that prevents worker_enter_idle() from accessing other
> CPUs' gcwq_nr_running variables?

Workers are tied to global cpu workqueues (gcwqs). There's one gcwq
per cpu and one unbound one, so yeah, workers access these counters
under gcwq->lock. Atomic accesses to nr_running is depended on only
while nr_idle is adjusted under gcwq->lock, so there shouldn't be a
discrepancy there. Can you reproduce the problem? What was going on
the system? Was CPU being brought up or down?

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/