Re: [PATCH 2/2] locking/percpu-rwsem: Introduce bias knob

From: Peter Zijlstra
Date: Thu Jul 14 2016 - 15:38:08 EST


On Thu, Jul 14, 2016 at 12:29:59PM -0700, Paul E. McKenney wrote:
> On Thu, Jul 14, 2016 at 09:20:18PM +0200, Peter Zijlstra wrote:
> > /**
> > + * rcu_sync_sabotage() - Sabotage a fresh rcu_sync instance
> > + * @rsp: Pointer to rcu_sync structure to be sabotaged
> > + *
> > + * Must be called after rcu_sync_init() and before first use.
> > + *
> > + * Ensures rcu_sync_is_idle() returns false and rcu_sync_{enter,exit}() pairs
> > + * turn into NO-OPs.
> > + */
> > +void rcu_sync_sabotage(struct rcu_sync *rsp)
> > +{
> > + rsp->gp_count++;
> > + rsp->gp_state = !GP_IDLE;
>
> ??? A very strange way to say GP_PENDING. A new GP_DISABLED, perhaps?

Right, so the important thing is that its not GP_IDLE, the rest doesn't
really matter.

This forces rcu_sync_is_idle() to return false. The skewed gp_count
ensures rcu_sync_{enter,exit}() pairs no-op.