[ltt-dev] [PATCH 2/2] introduce uatomic_and and uatomic_or

Mathieu Desnoyers compudj at krystal.dyndns.org
Fri Nov 12 07:38:57 EST 2010


* Mathieu Desnoyers (compudj at krystal.dyndns.org) wrote:
> * Paolo Bonzini (pbonzini at redhat.com) wrote:
> > On 11/12/2010 01:24 PM, Paolo Bonzini wrote:
> >> Should I rename uatomic_add to uatomic_xchg_add too (I prefer this name
> >> to uatomic_return_add)?
> >
> > Uh, uatomic_add returns void actually.  Then returning void from  
> > uatomic_{and,or} is indeed more consistent.
> 
> Ah! I knew we'd find the culprit!! ;-)

BTW, I'd be fine with adding:

uatomic_and/uatomic_or (returning void)

But I wonder if, on any architecture, there is a significantly better
way to implement:

uatomic_xchg_add/uatomic_xchg_or (returning the old value)

other than using a cmpxchg() underneath ? If not, then creating this
extra primitive would be pretty much useless.

Thanks,

Mathieu


-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list