Re: [PATCH 2/2] locking/percpu-rwsem: Introduce bias knob
From: Peter Zijlstra
Date: Thu Jul 14 2016 - 14:37:51 EST
On Thu, Jul 14, 2016 at 08:25:47PM +0200, Peter Zijlstra wrote:
> @@ -19,6 +20,13 @@ int __percpu_init_rwsem(struct percpu_rw
>
> /* ->rw_sem represents the whole percpu_rw_semaphore for lockdep */
> rcu_sync_init(&sem->rss, RCU_SCHED_SYNC);
> + if (bias == PERCPU_RWSEM_WRITER) {
> + /*
> + * Disable rcu_sync() and force slow path.
> + */
> + sem->rss.gp_count++;
> + sem->rss.gp_state = !0;
> + }
> __init_rwsem(&sem->rw_sem, name, rwsem_key);
> init_waitqueue_head(&sem->writer);
> sem->state = readers_slow;
So this seemed like a better deal than calling rcu_sync_enter(), because
that would still incur a (pointless) synchronize_sched() at init time
and people do tend to complain about things like that.