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


Groups > linux.kernel > #1183501

Re: [PATCH 1/7] locking/pvqspinlock: Only kick CPU at unlock time

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/7] locking/pvqspinlock: Only kick CPU at unlock time
Date 2015-07-14 11:40 +0200
Message-ID <pM4QX-sa-45@gated-at.bofh.it> (permalink)
References <pL9IZ-7CW-3@gated-at.bofh.it> <pL9J0-7CW-17@gated-at.bofh.it> <pLMhk-5Fo-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jul 13, 2015 at 03:48:28PM +0200, Peter Zijlstra wrote:
> @@ -239,9 +265,16 @@ static void pv_wait_head(struct qspinloc
>  			cpu_relax();
>  		}
>  
> -		WRITE_ONCE(pn->state, vcpu_halted);
> +		/*
> +		 * Either pv_kick_node() advanced us and ->state is already
> +		 * vcpu_hashed and this store is superfluous, or this is the
> +		 * first in which case the below cmpxchg() provides the
> +		 * required barriers.
> +		 */
> +		WRITE_ONCE(pn->state, vcpu_hashed);

The easier option is of course to just move this store into the branch
below. That immediately clarifies the logic and avoids the superfluous
store.

>  		if (!lp) { /* ONCE */
>  			lp = pv_hash(lock, pn);
> +
>  			/*
>  			 * lp must be set before setting _Q_SLOW_VAL
>  			 *
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

Re: [PATCH 1/7] locking/pvqspinlock: Only kick CPU at unlock time Peter Zijlstra <peterz@infradead.org> - 2015-07-14 11:40 +0200

csiph-web