lkml.org 
[lkml]   [2014]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] rwsem: Support optimistic spinning
From
Date
On Wed, 2014-06-04 at 13:57 -0400, Andev wrote:
> Hi,
>
> On Tue, Apr 29, 2014 at 11:11 AM, Paul E. McKenney
> <paulmck@linux.vnet.ibm.com> wrote:
> > On Mon, Apr 28, 2014 at 05:50:49PM -0700, Tim Chen wrote:
> >> On Mon, 2014-04-28 at 16:10 -0700, Paul E. McKenney wrote:
> >>
> >> > > +#ifdef CONFIG_SMP
> >> > > +static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem)
> >> > > +{
> >> > > + int retval;
> >> > > + struct task_struct *owner;
> >> > > +
> >> > > + rcu_read_lock();
> >> > > + owner = ACCESS_ONCE(sem->owner);
> >> >
> >> > OK, I'll bite...
> >> >
> >> > Why ACCESS_ONCE() instead of rcu_dereference()?
> >>
> >> We're using it as a speculative check on the sem->owner to see
> >> if the owner is running on the cpu. The rcu_read_lock
> >> is used for ensuring that the owner->on_cpu memory is
> >> still valid.
> >
> > OK, so if we read complete garbage, all that happens is that we
> > lose a bit of performance? If so, I am OK with it as long as there
> > is a comment (which Davidlohr suggested later in this thread).
> >
> > Thanx, Paul
> >
>
> The latest code seems to be missing this comment. Could you please add this?

The comment is there when we declare ->owner in struct rw_semaphore.




\
 
 \ /
  Last update: 2014-06-04 22:21    [W:0.616 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site