x86: Use asm goto to implement better modify_and_test() functions
authorPeter Zijlstra <peterz@infradead.org>
Wed, 11 Sep 2013 13:19:24 +0000 (15:19 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 25 Sep 2013 11:53:08 +0000 (13:53 +0200)
commit0c44c2d0f459cd7e275242b72f500137c4fa834d
treefdd16d5585a986cf8cbed140f533d08d152bbc4f
parent4314895165623879937f46d767673654662b570c
x86: Use asm goto to implement better modify_and_test() functions

Linus suggested using asm goto to get rid of the typical SETcc + TEST
instruction pair -- which also clobbers an extra register -- for our
typical modify_and_test() functions.

Because asm goto doesn't allow output fields it has to include an
unconditinal memory clobber when it changes a memory variable to force
a reload.

Luckily all atomic ops already imply a compiler barrier to go along
with their memory barrier semantics.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-0mtn9siwbeo1d33bap1422se@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/atomic.h
arch/x86/include/asm/atomic64_64.h
arch/x86/include/asm/bitops.h
arch/x86/include/asm/local.h
arch/x86/include/asm/rmwcc.h [new file with mode: 0644]