From: Ezequiel Garcia Date: Fri, 19 Oct 2012 12:33:11 +0000 (-0300) Subject: mm/slob: Use object_size field in kmem_cache_size() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fe74fe2bf293d061826f0d7afc2ca8456bdbb40e;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git mm/slob: Use object_size field in kmem_cache_size() Fields object_size and size are not the same: the latter might include slab metadata. Return object_size field in kmem_cache_size(). Also, improve trace accuracy by correctly tracing reported size. Cc: Pekka Enberg Cc: Matt Mackall Acked-by: Christoph Lameter Acked-by: David Rientjes Signed-off-by: Ezequiel Garcia Signed-off-by: Pekka Enberg --- diff --git a/mm/slob.c b/mm/slob.c index 06a5ec70e728..287a88aa4a61 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -554,12 +554,12 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node) if (c->size < PAGE_SIZE) { b = slob_alloc(c->size, flags, c->align, node); - trace_kmem_cache_alloc_node(_RET_IP_, b, c->size, + trace_kmem_cache_alloc_node(_RET_IP_, b, c->object_size, SLOB_UNITS(c->size) * SLOB_UNIT, flags, node); } else { b = slob_new_pages(flags, get_order(c->size), node); - trace_kmem_cache_alloc_node(_RET_IP_, b, c->size, + trace_kmem_cache_alloc_node(_RET_IP_, b, c->object_size, PAGE_SIZE << get_order(c->size), flags, node); } @@ -606,7 +606,7 @@ EXPORT_SYMBOL(kmem_cache_free); unsigned int kmem_cache_size(struct kmem_cache *c) { - return c->size; + return c->object_size; } EXPORT_SYMBOL(kmem_cache_size);