[PATCH] atomic: add_unless cmpxchg optimise
authorNick Piggin <npiggin@suse.de>
Thu, 23 Mar 2006 11:01:02 +0000 (03:01 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 23 Mar 2006 15:38:17 +0000 (07:38 -0800)
commit0b2fcfdb8b4e7e379192f24ea2203163ddf5df1d
tree1f3995e41ab12ff76e737389e0b59a40c0c73668
parent713729e8b993cb880225e2ced50a3f5ac05c2b3f
[PATCH] atomic: add_unless cmpxchg optimise

Without branch hints, the very unlikely chance of the loop repeating due to
cmpxchg failure is unrolled with gcc-4 that I have tested.

Improve this for architectures with a native cas/cmpxchg.  llsc archs
should try to implement this natively.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Andi Kleen <ak@muc.de>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-i386/atomic.h
include/asm-ia64/atomic.h
include/asm-m68k/atomic.h
include/asm-s390/atomic.h
include/asm-sparc64/atomic.h
include/asm-x86_64/atomic.h