Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753073AbbGNJb4 (ORCPT ); Tue, 14 Jul 2015 05:31:56 -0400 Received: from casper.infradead.org ([85.118.1.10]:58642 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751020AbbGNJbz (ORCPT ); Tue, 14 Jul 2015 05:31:55 -0400 Date: Tue, 14 Jul 2015 11:31:48 +0200 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch Subject: Re: [PATCH 1/7] locking/pvqspinlock: Only kick CPU at unlock time Message-ID: <20150714093148.GY18673@twins.programming.kicks-ass.net> References: <1436647018-49734-1-git-send-email-Waiman.Long@hp.com> <1436647018-49734-2-git-send-email-Waiman.Long@hp.com> <20150713134828.GH3644@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150713134828.GH3644@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1002 Lines: 29 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/