Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932233AbbELIQr (ORCPT ); Tue, 12 May 2015 04:16:47 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:36647 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932120AbbELIQl (ORCPT ); Tue, 12 May 2015 04:16:41 -0400 Date: Tue, 12 May 2015 10:16:36 +0200 From: Hagen Paul Pfeifer To: Andrew Morton Cc: Denys Vlasenko , Linus Torvalds , Thomas Graf , "David S. Miller" , Bart Van Assche , Peter Zijlstra , David Rientjes , Oleg Nesterov , "Paul E. McKenney" , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] force inlining of spinlock ops Message-ID: <20150512081635.GB6969@virgo.local> References: <1431367042-31475-1-git-send-email-dvlasenk@redhat.com> <20150511151913.86c37cde9294700b4b0e26c4@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150511151913.86c37cde9294700b4b0e26c4@linux-foundation.org> X-Key-Id: 98350C22 X-Key-Fingerprint: 490F 557B 6C48 6D7E 5706 2EA2 4A22 8D45 9835 0C22 X-GPG-Key: gpg --recv-keys --keyserver wwwkeys.eu.pgp.net 98350C22 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2664 Lines: 66 * Andrew Morton | 2015-05-11 15:19:13 [-0700]: >Presumably Hagen didn't see the issue with spinlock functions. I >wonder why not. I think it is a compiler version thing. Not sure why I didn't see it. >I suppose we should get both these consolidated into a coherent whole. +1 (let wait for a moment and delay patch inclusion) >It's a bit irritating to have to do this: presumably gcc will get fixed >and the huge sprinkling of __always_inline will become less and less >relevant over time and people will have trouble distinguishing "real >__always_inline which was put here for a purpose" from "dopey >__always_inline to work around a short-term gcc glitch". > >__always_inline is one of those things where a usage site should always >be commented, because it's near impossible to work out why someone >chose to use it. Quick, tell me what's happening in include/linux/slab.h. > > >Perhaps we should do > >/* > * Comment goes here. It is very specific about gcc versions. > */ >#define inline_for_broken_gcc __always_inline yeah, but name it in a compiler independent way. Sometimes we may seen similar misbehaving with clang too. But see my other comments #define inline_for_broken_cc __always_inline >and then use inline_for_broken_gcc everywhere. That way, the reason >for the marker is self-explanatory and we can later hunt all these >things down and remvoe them. > >Also, the inline_for_broken_gcc definition can be made dependent on >particular gcc versions, which will allow us to easily keep an eye on >the behaviour of later gcc versions. Mhh, I am not a big fan of this. I think we maneuver into a unmaintainable area with this approach. We must test, check this for all compiler version, new version, all kinds of compiler flags, etc pp. Another Idea: we talk roundabout about 50 functions where inlining is mission critical (and correct) but gcc sometimes have trouble to do so. Why not enforce __always_inline there? E.g. annotate these rare function with enforce_inline to highlight that these functions are always inlined. No matter what optimization and what compiler flags: #define enforce_inline __always_inline Developers are encouraged to use inline - because then the compiler can decide based on his algorithms/heuristics if a function should be inlined or not. For some really hot & short function the developer can use enforce_inline - but this should be an exception. Hagen -- 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/