[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160314132356.GY6356@twins.programming.kicks-ass.net>
Date: Mon, 14 Mar 2016 14:23:56 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Davidlohr Bueso <dave@...olabs.net>
Cc: tglx@...utronix.de, mingo@...nel.org, bigeasy@...utronix.de,
umgwanakikbuti@...il.com, paulmck@...ux.vnet.ibm.com,
linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [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.
Powered by blists - more mailing lists