Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759342AbZATAvw (ORCPT ); Mon, 19 Jan 2009 19:51:52 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1761766AbZATAvh (ORCPT ); Mon, 19 Jan 2009 19:51:37 -0500 Received: from mx1.suse.de ([195.135.220.2]:44202 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759870AbZATAvc (ORCPT ); Mon, 19 Jan 2009 19:51:32 -0500 Date: Tue, 20 Jan 2009 01:51:24 +0100 From: Nick Piggin To: Linus Torvalds Cc: Ingo Molnar , Bernd Schmidt , Andi Kleen , David Woodhouse , Andrew Morton , Harvey Harrison , "H. Peter Anvin" , Chris Mason , Peter Zijlstra , Steven Rostedt , paulmck@linux.vnet.ibm.com, Gregory Haskins , Matthew Wilcox , Linux Kernel Mailing List , linux-fsdevel , linux-btrfs , Thomas Gleixner , Peter Morreale , Sven Dietrich , jh@suse.cz Subject: Re: gcc inlining heuristics was Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning Message-ID: <20090120005124.GD16304@wotan.suse.de> References: <20090112005228.GS26290@one.firstfloor.org> <496B86B5.3090707@t-online.de> <20090112193201.GA23848@one.firstfloor.org> <496BBE27.2020206@t-online.de> <20090119001345.GA9880@elte.hu> <20090119062212.GC22584@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1844 Lines: 43 On Tue, Jan 20, 2009 at 08:01:52AM +1100, Linus Torvalds wrote: > > > On Mon, 19 Jan 2009, Nick Piggin wrote: > > > > I want to know what is the problem with the restrict keyword? > > I'm sure I've read Linus ranting about how bad it is in the > > past... > > No, I don't think I've ranted about 'restrict'. I think it's a reasonable > solution for performance-critical code, and unlike the whole type-aliasing > model, it actually works for the _sane_ cases (ie doing some operation > over two arrays of the same type, and letting the compiler know that it > can access the arrays without fearing that writing to one would affect > reading from the other). > > The problem with 'restrict' is that almost nobody uses it, and it does > obviously require programmer input rather than the compiler doing it > automatically. But it should work well as a way to get Fortran-like > performance from HPC workloads written in C - which is where most of the > people are who really want the alias analysis. OK, that makes sense. I just had a vague feeling that you disliked it. > > it seems like a nice opt-in thing that can be used where the aliases are > > verified and the code is particularly performance critical... > > Yes. I think we could use it in the kernel, although I'm not sure how many > cases we would ever find where we really care. Yeah, we don't tend to do a lot of intensive data processing, so it is normally the cache misses that hurt most as you noted earlier. Some places it might be appropriate, though. It might be nice if it can bring code size down too... -- 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/