lkml.org 
[lkml]   [2016]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] rtmutex: Reduce top-waiter blocking on a lock
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.

\
 
 \ /
  Last update: 2016-03-14 15:01    [W:0.107 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site