Skip to content

Commit 76ebbe7

Browse files
wildea01Ingo Molnar
authored andcommitted
locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
In preparation for the removal of lockless_dereference(), which is the same as READ_ONCE() on all architectures other than Alpha, add an implicit smp_read_barrier_depends() to READ_ONCE() so that it can be used to head dependency chains on all architectures. Signed-off-by: Will Deacon <will.deacon@arm.com> 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> Link: http://lkml.kernel.org/r/1508840570-22169-3-git-send-email-will.deacon@arm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent d151558 commit 76ebbe7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/linux/compiler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
242242
__read_once_size(&(x), __u.__c, sizeof(x)); \
243243
else \
244244
__read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
245+
smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
245246
__u.__val; \
246247
})
247248
#define READ_ONCE(x) __READ_ONCE(x, 1)

0 commit comments

Comments
 (0)