From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH v8 3/6] MCS Lock: optimizations and extra comments Date: Tue, 21 Jan 2014 11:17:42 +0100 Message-ID: <20140121101742.GR31570@twins.programming.kicks-ass.net> References: <1390267468.3138.37.camel@schen9-DESK> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1390267468.3138.37.camel@schen9-DESK> Sender: owner-linux-mm@kvack.org To: Tim Chen Cc: Ingo Molnar , Andrew Morton , Thomas Gleixner , "Paul E.McKenney" , Will Deacon , linux-kernel@vger.kernel.org, linux-mm , linux-arch@vger.kernel.org, Linus Torvalds , Waiman Long , Andrea Arcangeli , Alex Shi , Andi Kleen , Michel Lespinasse , Davidlohr Bueso , Matthew R Wilcox , Dave Hansen , Rik van Riel , Peter Hurley , Raghavendra K T , George Spelvin , "H. Peter Anvin" , Arnd Bergmann , Aswin List-Id: linux-arch.vger.kernel.org On Mon, Jan 20, 2014 at 05:24:28PM -0800, Tim Chen wrote: > @@ -41,8 +47,11 @@ void mcs_spin_lock(struct mcs_spinlock **lock, struct mcs_spinlock *node) > > prev = xchg(lock, node); > if (likely(prev == NULL)) { > - /* Lock acquired */ > - node->locked = 1; > + /* Lock acquired, don't need to set node->locked to 1 > + * as lock owner and other contenders won't check this value. > + * If a debug mode is needed to audit lock status, then > + * set node->locked value here. > + */ Fail in comment style. > return; > } > ACCESS_ONCE(prev->next) = node; -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from merlin.infradead.org ([205.233.59.134]:48888 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753624AbaAUKS2 (ORCPT ); Tue, 21 Jan 2014 05:18:28 -0500 Date: Tue, 21 Jan 2014 11:17:42 +0100 From: Peter Zijlstra Subject: Re: [PATCH v8 3/6] MCS Lock: optimizations and extra comments Message-ID: <20140121101742.GR31570@twins.programming.kicks-ass.net> References: <1390267468.3138.37.camel@schen9-DESK> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1390267468.3138.37.camel@schen9-DESK> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Tim Chen Cc: Ingo Molnar , Andrew Morton , Thomas Gleixner , "Paul E.McKenney" , Will Deacon , linux-kernel@vger.kernel.org, linux-mm , linux-arch@vger.kernel.org, Linus Torvalds , Waiman Long , Andrea Arcangeli , Alex Shi , Andi Kleen , Michel Lespinasse , Davidlohr Bueso , Matthew R Wilcox , Dave Hansen , Rik van Riel , Peter Hurley , Raghavendra K T , George Spelvin , "H. Peter Anvin" , Arnd Bergmann , Aswin Chandramouleeswaran , Scott J Norton , "Figo.zhang" Message-ID: <20140121101742.f53J39qsl9LZXOtvugGcyNBRYm6XnC2HB-tarEAZKfk@z> On Mon, Jan 20, 2014 at 05:24:28PM -0800, Tim Chen wrote: > @@ -41,8 +47,11 @@ void mcs_spin_lock(struct mcs_spinlock **lock, struct mcs_spinlock *node) > > prev = xchg(lock, node); > if (likely(prev == NULL)) { > - /* Lock acquired */ > - node->locked = 1; > + /* Lock acquired, don't need to set node->locked to 1 > + * as lock owner and other contenders won't check this value. > + * If a debug mode is needed to audit lock status, then > + * set node->locked value here. > + */ Fail in comment style. > return; > } > ACCESS_ONCE(prev->next) = node;