Re: [PATCH 01/15] perf_counter: unify and fix delayed counterwakeup

From: Peter Zijlstra
Date: Tue Mar 31 2009 - 02:36:42 EST


On Tue, 2009-03-31 at 16:45 +1100, Paul Mackerras wrote:
> Peter Zijlstra writes:
>
> > +void perf_counter_wakeup(struct perf_counter *counter)
> > +{
> > + struct perf_mmap_data *data;
> > +
> > + rcu_read_lock();
> > + data = rcu_dereference(counter->data);
> > + if (data) {
> > + (void)atomic_xchg(&data->wakeup, POLL_IN);
>
> Really just a nit, but how is this atomic_xchg any different from
> atomic_set(&data->wakeup, POLL_IN) aside from being slower?

Probably, I got my head in a twist, atomic_set() is simply an unlocked
assignment (although volatile), and I read the value using a locked
xchg().

I wasn't sure how these two would interact and so I chickened out :-)

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