Subject: Re: [PATCH 08/40] mm: kmem_cache_objsize

From: Pekka Enberg <[email-masked]>
Date: Fri, 04 May 2007 21:45:55 +0300

On Fri, 2007-05-04 at 11:30 -0700, Christoph Lameter wrote:
> > Hmmm... Maybe lets have
> >
> > unsigned kmem_estimate_pages(struct kmem_cache *slab_cache, int objects)
> >
> > which would calculate the worst case memory scenario for allocation the 
> > number of indicated objects?

On Fri, 4 May 2007, Peter Zijlstra wrote:
> Perfectly fine with me, Pekka, any objections?

Again, slab has no way of actually estimating how many pages you need 
for a given number of objects. So we end up calculating some upper bound 
which doesn't belong in mm/slab.c. I am perfectly okay with:

   (1) kmem_nr_bytes_per_object which is what Peter has now

or alternatively,

   (2) kmem_nr_objects_per_page which I think Christoph suggested

Both of them, the slab knows the answer, and doesn't need to guess. It's 
up to the caller to figure out what the acceptable upper bound is.

			Pekka