On Tue, Mar 08, 2016 at 10:20:23AM -0800, Davidlohr Bueso wrote:
> lock->owner = (void *) RT_MUTEX_HAS_WAITERS;
> static inline struct task_struct *rt_mutex_owner(struct rt_mutex *lock)
> {
> return (struct task_struct *)
> - ((unsigned long)lock->owner & ~RT_MUTEX_OWNER_MASKALL);
> + ((unsigned long)READ_ONCE(lock->owner) &
> ~RT_MUTEX_OWNER_MASKALL);
> }
If you READ_ONCE(), you should also WRITE_ONCE(), because while the
write is under the proper locks, our friendly compiler might still
choose to emit the store in a random sequence of byte stores, rendering
our READ_ONCE() pointless.