Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1945945AbXBVCBx (ORCPT ); Wed, 21 Feb 2007 21:01:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1945946AbXBVCBx (ORCPT ); Wed, 21 Feb 2007 21:01:53 -0500 Received: from filer.fsl.cs.sunysb.edu ([130.245.126.2]:36237 "EHLO filer.fsl.cs.sunysb.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1945945AbXBVCBw (ORCPT ); Wed, 21 Feb 2007 21:01:52 -0500 Date: Wed, 21 Feb 2007 21:00:39 -0500 From: Josef Sipek To: Andrew Morton Cc: Pekka Enberg , Adrian Bunk , linux-kernel@vger.kernel.org, unionfs@filesystems.org Subject: Re: [-mm patch] UNION_FS must depend on SLAB Message-ID: <20070222020036.GE5867@filer.fsl.cs.sunysb.edu> References: <20070217215146.30e7ffa3.akpm@linux-foundation.org> <20070220000810.GK13958@stusta.de> <84144f020702192237k78a5045bl51e0871fb3cac253@mail.gmail.com> <20070220151356.GA19239@filer.fsl.cs.sunysb.edu> <20070221141944.af6001db.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070221141944.af6001db.akpm@linux-foundation.org> User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2409 Lines: 62 On Wed, Feb 21, 2007 at 02:19:44PM -0800, Andrew Morton wrote: > On Tue, 20 Feb 2007 10:13:56 -0500 > Josef Sipek wrote: > > > On Tue, Feb 20, 2007 at 08:37:34AM +0200, Pekka Enberg wrote: > > > On 2/20/07, Adrian Bunk wrote: > > > > CC fs/unionfs/copyup.o > > > >/home/bunk/linux/kernel-2.6/linux-2.6.20-mm2/fs/unionfs/copyup.c: In > > > >function 'create_parents_named': > > > >/home/bunk/linux/kernel-2.6/linux-2.6.20-mm2/fs/unionfs/copyup.c:620: > > > >error: 'malloc_sizes' undeclared (first use in this function) > > > >/home/bunk/linux/kernel-2.6/linux-2.6.20-mm2/fs/unionfs/copyup.c:620: > > > >error: (Each undeclared identifier is reported only once > > > >/home/bunk/linux/kernel-2.6/linux-2.6.20-mm2/fs/unionfs/copyup.c:620: > > > >error: for each function it appears in.) > > > >make[3]: *** [fs/unionfs/copyup.o] Error 1 > > > > > > Hmm, why is unionfs playing around with malloc_sizes in the first place? > > > Jeff? > > > > The code is in lookup.c: > > > > if (oldsize) { > > int minsize = malloc_sizes[0].cs_size; > > > > if (!newsize || ((oldsize < newsize) && (newsize > minsize))) { > > kfree(info->lower_paths); > > info->lower_paths = NULL; > > } > > } > > > > That's the only user of malloc_sizes. It is supposed to be an optimization - > > we get the smallest sized piece of memory even if we don't need all of it. > > This way we don't reallocate & memcpy needlessly. > > > > urgh, no, please don't poke around in slab internals like that. I agree that it is a hack. > I can't say more until I've managed to understand your description, which > might take a while. It is intended for reallocation of a buffer. The code in lookup.c allocates some memory, and it may have to reallocate the buffer. The code tries to prevent some unneeded allocations by looking at what the smallest object the slabcache gives you is. I hope this explains it better. There's some discussion about this in the threads by Pekka Enberg. Josef "Jeff" Sipek. -- Linux, n.: Generous programmers from around the world all join forces to help you shoot yourself in the foot for free. - 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/