From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "smtp.linux-foundation.org", Issuer "CA Cert Signing Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id D0012DDDEA for ; Tue, 18 Nov 2008 08:43:28 +1100 (EST) Date: Mon, 17 Nov 2008 13:42:35 -0800 (PST) From: Linus Torvalds To: Andrew Morton Subject: Re: Large stack usage in fs code (especially for PPC64) In-Reply-To: <20081117133137.616cf287.akpm@linux-foundation.org> Message-ID: References: <20081117130856.92e41cd3.akpm@linux-foundation.org> <20081117133137.616cf287.akpm@linux-foundation.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, linuxppc-dev@ozlabs.org, paulus@samba.org, mingo@elte.hu, tglx@linutronix.de List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Mon, 17 Nov 2008, Andrew Morton wrote: > > Yup. That being said, the younger me did assert that "this is a neater > implementation anyway". If we can implement those loops without > needing those on-stack temporary arrays then things probably are better > overall. Sure, if it actually ends up being nicer, I'll not argue with it. But from an L1 I$ standpoint (and I$ is often very important, especially for kernel loads where loops are fairly rare), it's often _much_ better to do two "tight" loops over two subsystems (filesystem and block layer) than it is to do one bigger loop that contains both. If the L1 can fit both subsystem paths, you're fine - but if not, you may get a lot more misses. So it's often nice if you can "stage" things so that you do a cluster of calls to one area, followed by a cluster of calls to another, rather than mix it up. But numbers talk. And code cleanliness. If somebody has numbers that the code size actually goes down for example, or the code is just more readable, micro-optimizing cache patterns isn't worth it. Linus