On Sun, 2013-06-23 at 13:03 -0700, Davidlohr Bueso wrote:On Sat, 2013-06-22 at 03:57 -0400, Peter Hurley wrote:On 06/21/2013 07:51 PM, Tim Chen wrote:^^^^^^^^^^^^^^^^^^
+static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem)
+{
+ int retval = true;
+
+ /* Spin only if active writer running */
+ if (!sem->owner)
+ return false;
+
+ rcu_read_lock();
+ if (sem->owner)
+ retval = sem->owner->on_cpu;
Why is this a safe dereference? Could not another cpu have just
dropped the sem (and thus set sem->owner to NULL and oops)?
The rcu read lock should protect against sem->owner being NULL.