Re: [Patch] Idle balancer: cache align nohz structure to improveidle load balancing scalability

From: Suresh Siddha
Date: Wed Nov 02 2011 - 11:14:29 EST


On Wed, 2011-11-02 at 06:54 -0700, Srivatsa Vaddagiri wrote:
> * Suresh Siddha <suresh.b.siddha@xxxxxxxxx> [2011-11-01 16:52:38]:
>
> > + /*
> > + * We were recently in tickless idle mode. We will do the delayed
> > + * update of busy mode now (first busy tick after returning from idle).
> > + */
> > + if (unlikely(rq->tick_stopped)) {
> > + cpumask_clear_cpu(cpu, nohz.idle_cpus_mask);
> > +
> > + if (cpumask_bits(nohz.idle_cpus_mask)[BIT_WORD(cpu)] == 0 &&
> > + cpumask_empty(nohz.idle_cpus_mask))
> > + clear_bit(NOHZ_NEED_BALANCING, &nohz.bits);
>
> Can't this clear_bit race with set_bit() in select_nohz_load_balancer()?
>
> CPU0 CPU1
>
> cpumask_clear_cpu()
> if ( ...)
> cpumask_set_cpu();
> set_bit();
>
> clear_bit();
>
> ?

Yes. All I want is a quick way of getting the
cpumask_weight(nohz.idle_cpus_mask) so that the busy cpu need not spend
much time to see if there is an idle cpu that needs idle load balancing.
Let me see if there is any simple way or else we need nohz.nr_idle_cpus

thanks,
suresh

--
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/