aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slob.c
diff options
context:
space:
mode:
authorEzequiel Garcia <elezegarcia@gmail.com>2012-10-19 08:33:11 -0400
committerPekka Enberg <penberg@kernel.org>2012-10-31 02:51:35 -0400
commitfe74fe2bf293d061826f0d7afc2ca8456bdbb40e (patch)
tree6350a32c300e3ff74b4ff52355f98a751f6a2442 /mm/slob.c
parent999d8795d438d396936811b185428d70b7b7de6d (diff)
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 <penberg@kernel.org> Cc: Matt Mackall <mpm@selenic.com> Acked-by: Christoph Lameter <cl@linux.com> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slob.c')
-rw-r--r--mm/slob.c6
1 files changed, 3 insertions, 3 deletions
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)
554 554
555 if (c->size < PAGE_SIZE) { 555 if (c->size < PAGE_SIZE) {
556 b = slob_alloc(c->size, flags, c->align, node); 556 b = slob_alloc(c->size, flags, c->align, node);
557 trace_kmem_cache_alloc_node(_RET_IP_, b, c->size, 557 trace_kmem_cache_alloc_node(_RET_IP_, b, c->object_size,
558 SLOB_UNITS(c->size) * SLOB_UNIT, 558 SLOB_UNITS(c->size) * SLOB_UNIT,
559 flags, node); 559 flags, node);
560 } else { 560 } else {
561 b = slob_new_pages(flags, get_order(c->size), node); 561 b = slob_new_pages(flags, get_order(c->size), node);
562 trace_kmem_cache_alloc_node(_RET_IP_, b, c->size, 562 trace_kmem_cache_alloc_node(_RET_IP_, b, c->object_size,
563 PAGE_SIZE << get_order(c->size), 563 PAGE_SIZE << get_order(c->size),
564 flags, node); 564 flags, node);
565 } 565 }
@@ -606,7 +606,7 @@ EXPORT_SYMBOL(kmem_cache_free);
606 606
607unsigned int kmem_cache_size(struct kmem_cache *c) 607unsigned int kmem_cache_size(struct kmem_cache *c)
608{ 608{
609 return c->size; 609 return c->object_size;
610} 610}
611EXPORT_SYMBOL(kmem_cache_size); 611EXPORT_SYMBOL(kmem_cache_size);
612 612