From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Subject: Re: gcc inlining heuristics was Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning Date: Wed, 21 Jan 2009 10:20:49 +0100 Message-ID: <20090121092049.GE15750@one.firstfloor.org> References: <20090119062212.GC22584@wotan.suse.de> <20090120005124.GD16304@wotan.suse.de> <20090120123824.GD7790@elte.hu> <1232480940.22233.1435.camel@macbook.infradead.org> <20090120210515.GC19710@elte.hu> <20090120220516.GA10483@elte.hu> <20090121085402.GD15750@one.firstfloor.org> <20090121085208.GO24891@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andi Kleen , Ingo Molnar , Linus Torvalds , David Woodhouse , Bernd Schmidt , 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 To: Nick Piggin Return-path: Received: from one.firstfloor.org ([213.235.205.2]:41958 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755514AbZAUJFi (ORCPT ); Wed, 21 Jan 2009 04:05:38 -0500 Content-Disposition: inline In-Reply-To: <20090121085208.GO24891@wotan.suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Jan 21, 2009 at 09:52:08AM +0100, Nick Piggin wrote: > On Wed, Jan 21, 2009 at 09:54:02AM +0100, Andi Kleen wrote: > > > GCC 4.3.2. Maybe i missed something obvious? > > > > The typical use case of restrict is to tell it that multiple given > > arrays are independent and then give the loop optimizer > > more freedom to handle expressions in the loop that > > accesses these arrays. > > > > Since there are no loops in the list functions nothing changed. > > > > Ok presumably there are some other optimizations which > > rely on that alias information too, but again the list_* > > stuff is probably too simple to trigger any of them. > > Any function that does several interleaved loads and stores > through different pointers could have much more freedom to > move loads early and stores late. For once that would require more live registers. It's not a clear and obvious win. Especially not if you have only very little registers, like on 32bit x86. Then it would typically increase code size. Then x86s tend to have very very fast L1 caches and if something is not in L1 on reads then the cost of fetching something for a read dwarfs the few cycles you can typically get out of this. And lastly even on a in order system stores can be typically queued without stalling, so it doesn't hurt to do them early. Also at least x86 gcc normally doesn't do scheduling beyond basic blocks, so any if () shuts it up. -Andi -- ak@linux.intel.com -- Speaking for myself only.