On Mon, Jun 24, 2013 at 04:20:51PM -0700, Tim Chen wrote:
> +#ifdef CONFIG_RWSEM_SPIN_ON_WRITE_OWNER
> +static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem)
> +{
> +     int retval;
> +     task_struct *owner;
> +
> +     rcu_read_lock();
> +     owner = sem->owner;

That wants to be: owner = ACCESS_ONCE(sem->owner);

> +
> +     /* Spin only if active writer running */
> +     if (owner)
> +             retval = owner->on_cpu;
> +     else
> +             retval = false;
> +
> +     rcu_read_unlock();
> +     /*
> +      * if lock->owner is not set, the sem owner may have just acquired
> +      * it and not set the owner yet, or the sem has been released, or
> +      * reader active.
> +      */
> +     return retval;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to