From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Pekka Enberg" Subject: Re: [PATCH 08/40] mm: kmem_cache_objsize Date: Fri, 4 May 2007 13:54:32 +0300 Message-ID: <84144f020705040354r5cb74c5fj6cb8698f93ffcb83@mail.gmail.com> References: <20070504102651.923946304@chello.nl> <20070504103157.215424767@chello.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, "Trond Myklebust" , "Thomas Graf" , "David Miller" , "James Bottomley" , "Mike Christie" , "Andrew Morton" , "Daniel Phillips" , "Christoph Lameter" To: "Peter Zijlstra" Return-path: Received: from ug-out-1314.google.com ([66.249.92.172]:10797 "EHLO ug-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1767880AbXEDKyd (ORCPT ); Fri, 4 May 2007 06:54:33 -0400 Received: by ug-out-1314.google.com with SMTP id 44so625309uga for ; Fri, 04 May 2007 03:54:32 -0700 (PDT) In-Reply-To: <20070504103157.215424767@chello.nl> Content-Disposition: inline Sender: netdev-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 5/4/07, Peter Zijlstra wrote: > Expost buffer_size in order to allow fair estimates on the actual space > used/needed. [snip] > #ifdef CONFIG_SLAB_FAIR > -static inline int slab_alloc_rank(gfp_t flags) > +static __always_inline int slab_alloc_rank(gfp_t flags) > { > return gfp_to_rank(flags); > } > #else > -static inline int slab_alloc_rank(gfp_t flags) > +static __always_inline int slab_alloc_rank(gfp_t flags) > { > return 0; > } Me thinks this hunk doesn't belong in this patch. > @@ -3815,6 +3815,12 @@ unsigned int kmem_cache_size(struct kmem > } > EXPORT_SYMBOL(kmem_cache_size); > > +unsigned int kmem_cache_objsize(struct kmem_cache *cachep) > +{ > + return cachep->buffer_size; > +} > +EXPORT_SYMBOL_GPL(kmem_cache_objsize); > + > const char *kmem_cache_name(struct kmem_cache *cachep) > { > return cachep->name; > @@ -4512,3 +4518,9 @@ unsigned int ksize(const void *objp) > > return obj_size(virt_to_cache(objp)); > } > + > +unsigned int kobjsize(size_t size) > +{ > + return kmem_cache_objsize(kmem_find_general_cachep(size, 0)); > +} > +EXPORT_SYMBOL_GPL(kobjsize); Looks good to me. Unfortunately, you need to do SLUB as well. Aah, the wonders of three kernel memory allocators... ;-) Pekka