[openib-general] Re: [PATCH] opensm: make cl_atomic functions atomic
Jean-Christophe Hugly
jice at pantasys.com
Mon Mar 6 11:02:45 PST 2006
On Mon, 2006-03-06 at 19:29 +0200, Michael S. Tsirkin wrote:
> The right thing to do is to look at the implementation
> and write your own for architectures that matter.
> Use lock for others.
If performance at that point is *that* critical...
I used the following in the past for x86. Tested on 32bit only.
That's my own code, not my employers. So, I donate it, fwiw.
inline void AtomicInc(int volatile& x) {
__asm__ volatile ("lock\nincl %0" : : "m" (x));
}
inline void AtomicDec(int volatile& x) {
__asm__ volatile ("lock\ndecl %0" : : "m" (x));
}
--
Jean-Christophe Hugly <jice at pantasys.com>
PANTA
More information about the general
mailing list