Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1443671

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

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] locking/percpu-rwsem: Introduce bias knob
Date 2016-07-14 20:40 +0200
Message-ID <rUTIe-4Mw-15@gated-at.bofh.it> (permalink)
References <rUTIe-4Mw-13@gated-at.bofh.it> <rUTIe-4Mw-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 2/2] locking/percpu-rwsem: Introduce bias knob Peter Zijlstra <peterz@infradead.org> - 2016-07-14 20:40 +0200

csiph-web