Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755029AbYKQVnq (ORCPT ); Mon, 17 Nov 2008 16:43:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754635AbYKQVnb (ORCPT ); Mon, 17 Nov 2008 16:43:31 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:53497 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754251AbYKQVna (ORCPT ); Mon, 17 Nov 2008 16:43:30 -0500 Date: Mon, 17 Nov 2008 13:42:35 -0800 (PST) From: Linus Torvalds To: Andrew Morton cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org, paulus@samba.org, benh@kernel.crashing.org, linuxppc-dev@ozlabs.org, mingo@elte.hu, tglx@linutronix.de, linux-mm@kvack.org 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> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1331 Lines: 30 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 -- 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/