Re: [patch 1/2] sched: Change the nohz ilb logic from pull to pushmodel

From: Peter Zijlstra
Date: Mon Dec 21 2009 - 08:01:30 EST


On Mon, 2009-12-21 at 13:13 +0100, Peter Zijlstra wrote:
>
> > + ret = atomic_cmpxchg(&nohz.first_pick_cpu, -1, cpu);
> > + if (ret == -1 || ret == cpu) {
> > + atomic_cmpxchg(&nohz.second_pick_cpu, cpu, -1);
> > + if (rq->nr_running > 1)
> > + return 1;
> > + } else {
> > + ret = atomic_cmpxchg(&nohz.second_pick_cpu, -1, cpu);
> > + if (ret == -1 || ret == cpu) {
> > + if (rq->nr_running)
> > + return 1;
> > }
> > }
>
> Looked very funny, and took a while to understand why you're doing that,
> but yeah, I can't see a better way of doing it either.

That is, the sanest way to write that is to do something like:

weight(~nohz & online) == 1 && nr_running == 1

except that with the recent cpumask blowout that's a very expensive op.

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