[PATCH] SLUB: Use ->objsize from struct kmem_cache_cpu in slab_free()

From: Pekka J Enberg
Date: Wed Jan 14 2009 - 05:29:28 EST


From: Pekka Enberg <penberg@xxxxxxxxxxxxxx>

There's no reason to use ->objsize from struct kmem_cache in slab_free() for
the SLAB_DEBUG_OBJECTS case. All it does is generate extra cache pressure
as no one else touches struct kmem_cache in the fast-path.

Not that it matters all that much as the code is optimized away when
CONFIG_DEBUG_OBJECTS is disabled and when it is enabled, the
actual debugging checks are quite heavy-weight.

Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---
mm/slub.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 57aa749..fa651c1 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1727,7 +1727,7 @@ static __always_inline void slab_free(struct kmem_cache *s,
c = get_cpu_slab(s, smp_processor_id());
debug_check_no_locks_freed(object, c->objsize);
if (!(s->flags & SLAB_DEBUG_OBJECTS))
- debug_check_no_obj_freed(object, s->objsize);
+ debug_check_no_obj_freed(object, c->objsize);
if (likely(page == c->page && c->node >= 0)) {
object[c->offset] = c->freelist;
c->freelist = object;
--
1.5.4.3

--
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/