Messages in this thread |  | | | Subject | Re: [patch 1/2] sched: Change the nohz ilb logic from pull to push model | | From | Peter Zijlstra <> | | Date | Mon, 21 Dec 2009 14:00:36 +0100 |
| |
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.
|  |