atomic: Implement atomic_read_ctrl()
authorPeter Zijlstra <peterz@infradead.org>
Fri, 18 Sep 2015 11:22:52 +0000 (13:22 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 23 Sep 2015 07:54:29 +0000 (09:54 +0200)
commite3e72ab80a3fac0b88e07d358a2c75724ccd66b4
tree3cc1b2f6fbe8ca8d3649d95d14f7c093cea11480
parent62e8a3258bda118f24ff462fe04cfbe75b8189b5
atomic: Implement atomic_read_ctrl()

Provide atomic_read_ctrl() to mirror READ_ONCE_CTRL(), such that we can
more conveniently use atomics in control dependencies.

Since we can assume atomic_read() implies a READ_ONCE(), we must only
emit an extra smp_read_barrier_depends() in order to upgrade to
READ_ONCE_CTRL() semantics.

Requested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Cc: oleg@redhat.com
Link: http://lkml.kernel.org/r/20150918115637.GM3604@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Documentation/memory-barriers.txt
include/asm-generic/atomic-long.h
include/linux/atomic.h