Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033650AbbKEQuD (ORCPT ); Thu, 5 Nov 2015 11:50:03 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:42186 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033345AbbKEQuA (ORCPT ); Thu, 5 Nov 2015 11:50:00 -0500 Date: Thu, 5 Nov 2015 17:49:51 +0100 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 , Davidlohr Bueso Subject: Re: [PATCH tip/locking/core v9 2/6] locking/qspinlock: prefetch next node cacheline Message-ID: <20151105164951.GI3604@twins.programming.kicks-ass.net> References: <1446247597-61863-1-git-send-email-Waiman.Long@hpe.com> <1446247597-61863-3-git-send-email-Waiman.Long@hpe.com> <20151102163626.GU3604@twins.programming.kicks-ass.net> <20151102225404.GY11639@twins.programming.kicks-ass.net> <563B86F3.9080703@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <563B86F3.9080703@hpe.com> 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: 894 Lines: 29 On Thu, Nov 05, 2015 at 11:42:27AM -0500, Waiman Long wrote: > If we observe next, we will observe val != tail sooner or later. It is not > possible for it to clear the tail code in the lock. The tail xchg will > guarantee that. > > Another alternative is to do something like > > + if (!next) > while (!(next = READ_ONCE(node->next))) > cpu_relax(); > Yes maybe, although the main reason I fell over this was because it was a separate change (and not mentioned in the Changelog). Although the above would need braces (per CodingStyle), so: if (!next) { while (!(next = READ_ONCE(node->next))) cpu_relax(); } -- 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/