lkml.org 
[lkml]   [2015]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/7] locking/pvqspinlock: Only kick CPU at unlock time
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
> *


\
 
 \ /
  Last update: 2015-07-14 12:01    [W:0.123 / U:1.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site