]> git.karo-electronics.de Git - karo-tx-linux.git/commit
locking/mutex: Set and clear owner using WRITE_ONCE()
authorJason Low <jason.low2@hpe.com>
Fri, 20 May 2016 22:19:36 +0000 (15:19 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 3 Jun 2016 10:06:10 +0000 (12:06 +0200)
commit6e2814745c67ab422b86262b05e6f23a56f28aa3
tree5e69ae55af787319cca75bf6b767adc0180eaafb
parentc0fcb6c2d332041256dc55d8a1ec3c0a2d0befb8
locking/mutex: Set and clear owner using WRITE_ONCE()

The mutex owner can get read and written to locklessly.
Use WRITE_ONCE when setting and clearing the owner field
in order to avoid optimizations such as store tearing. This
avoids situations where the owner field gets written to with
multiple stores and another thread could concurrently read
and use a partially written owner value.

Signed-off-by: Jason Low <jason.low2@hpe.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Davidlohr Bueso <dave@stgolabs.net>
Acked-by: Waiman Long <Waiman.Long@hpe.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: Scott J Norton <scott.norton@hpe.com>
Cc: Terry Rudd <terry.rudd@hpe.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1463782776.2479.9.camel@j-VirtualBox
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/mutex-debug.h
kernel/locking/mutex.h