Re: [PATCH 08/40] mm: kmem_cache_objsize

From: Pekka Enberg
Date: Fri May 04 2007 - 14:46:02 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/