Re: [PATCH rcu 08/15] srcu: Add srcu_read_lock_lite() and srcu_read_unlock_lite()
From: Paul E. McKenney
Date: Mon Nov 11 2024 - 13:08:28 EST
On Mon, Nov 11, 2024 at 09:46:22AM -0800, Andrii Nakryiko wrote:
> On Mon, Nov 11, 2024 at 7:17 AM Paul E. McKenney <paulmck@xxxxxxxxxx> wrote:
> >
> > On Mon, Nov 11, 2024 at 04:47:49PM +0530, Neeraj Upadhyay wrote:
> > >
> > > > +/**
> > > > + * srcu_read_unlock_lite - unregister a old reader from an SRCU-protected structure.
> > > > + * @ssp: srcu_struct in which to unregister the old reader.
> > > > + * @idx: return value from corresponding srcu_read_lock().
> > > > + *
> > > > + * Exit a light-weight SRCU read-side critical section.
> > > > + */
> > > > +static inline void srcu_read_unlock_lite(struct srcu_struct *ssp, int idx)
> > > > + __releases(ssp)
> > > > +{
> > > > + WARN_ON_ONCE(idx & ~0x1);
> > > > + srcu_check_read_flavor(ssp, SRCU_READ_FLAVOR_LITE);
> > > > + srcu_lock_release(&ssp->dep_map);
> > > > + __srcu_read_unlock(ssp, idx);
> > >
> > > s/__srcu_read_unlock/__srcu_read_unlock_lite/ ?
> >
> > Right you are! I am testing the patch.
> >
> > The effect of this bug is that srcu_read_unlock_lite() has a needless
> > memory barrier and fails to check for RCU watching, so not a blazing
> > emergency. But it does mean that Andrii was only seeing half of the
> > performance benefit of using _lite().
>
> That's exciting, happy to re-test once we have fixed patches.
Neeraj also found a functional error, so a bit more work to do.
Better him finding it that me doing so the hard way! ;-)
Thanx, Paul