From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by kanga.kvack.org (Postfix) with ESMTP id 8B6156B00EA for ; Wed, 6 Nov 2013 11:08:52 -0500 (EST) Received: by mail-pd0-f169.google.com with SMTP id q10so10448251pdj.28 for ; Wed, 06 Nov 2013 08:08:52 -0800 (PST) Received: from psmtp.com ([74.125.245.206]) by mx.google.com with SMTP id ba2si16829708pbc.268.2013.11.06.08.08.48 for ; Wed, 06 Nov 2013 08:08:49 -0800 (PST) Date: Wed, 6 Nov 2013 17:08:15 +0100 From: Peter Zijlstra Subject: Re: [PATCH v2 4/4] MCS Lock: Make mcs_spinlock.h includable in other files Message-ID: <20131106160815.GR10651@twins.programming.kicks-ass.net> References: <1383673359.11046.280.camel@schen9-DESK> <20131105185717.GZ16117@laptop.programming.kicks-ass.net> <1383679842.11046.298.camel@schen9-DESK> <527A60E3.3000106@hp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <527A60E3.3000106@hp.com> Sender: owner-linux-mm@kvack.org List-ID: To: Waiman Long Cc: Tim Chen , Ingo Molnar , Andrew Morton , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-mm , linux-arch@vger.kernel.org, Linus Torvalds , Andrea Arcangeli , Alex Shi , Andi Kleen , Michel Lespinasse , Davidlohr Bueso , Matthew R Wilcox , Dave Hansen , Rik van Riel , Peter Hurley , "Paul E.McKenney" , Raghavendra K T , George Spelvin , "H. Peter Anvin" , Arnd Bergmann , Aswin Chandramouleeswaran , Scott J Norton , Will Deacon On Wed, Nov 06, 2013 at 10:31:47AM -0500, Waiman Long wrote: > On 11/05/2013 02:30 PM, Tim Chen wrote: > >On Tue, 2013-11-05 at 19:57 +0100, Peter Zijlstra wrote: > >>On Tue, Nov 05, 2013 at 09:42:39AM -0800, Tim Chen wrote: > >>>+ * The _raw_mcs_spin_lock() function should not be called directly. Instead, > >>>+ * users should call mcs_spin_lock(). > >>> */ > >>>-static noinline > >>>-void mcs_spin_lock(struct mcs_spinlock **lock, struct mcs_spinlock *node) > >>>+static inline > >>>+void _raw_mcs_spin_lock(struct mcs_spinlock **lock, struct mcs_spinlock *node) > >>> { > >>> struct mcs_spinlock *prev; > >>> > >>So why keep it in the header at all? > >I also made the suggestion originally of keeping both lock and unlock in > >mcs_spinlock.c. Wonder if Waiman decides to keep them in header > >because in-lining the unlock function makes execution a bit faster? > > > >Tim > > > > I was following the example of the spinlock code where the lock function is > not inlined, but the unlock function is. I have no objection to make them > both as non-inlined functions, if you think that is the right move. I don't care, what I do find odd is the existence of _raw_mcs_spin_lock(). If you want to out-of-line it, just move the entire thing into a .c file already. -- 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