lkml.org 
[lkml]   [2009]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 01/15] perf_counter: unify and fix delayed counter wakeup

* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> 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
> :-)

The fact that you needed to use an ugly cast to silence the compiler
should have told you that we kernel developers never chicken out! :)

(And if we do, it's called an orderly tactical retreat.)

Ingo


\
 
 \ /
  Last update: 2009-04-01 11:07    [W:0.072 / U:0.516 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site