summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2008-02-15 23:45:25 -0800
committerChristoph Lameter <clameter@sgi.com>2008-03-03 12:22:31 -0800
commitae20bfda6813387af18c7fdbc0f8b1fa7be2d05b (patch)
tree4455ba4cdd5a7bd1d3da13915965f1aed2dd84b0 /mm
parent27d9e4e94862c89d171cf70911b4f11ad69fb54e (diff)
slub: Remove BUG_ON() from ksize and omit checks for !SLUB_DEBUG
The BUG_ONs are useless since the pointer derefs will lead to NULL deref errors anyways. Some of the checks are not necessary if no debugging is possible. Signed-off-by: Christoph Lameter <clameter@sgi.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/slub.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/slub.c b/mm/slub.c
index b49570ca08b..09b5dc82df5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2610,19 +2610,17 @@ size_t ksize(const void *object)
struct page *page;
struct kmem_cache *s;
- BUG_ON(!object);
if (unlikely(object == ZERO_SIZE_PTR))
return 0;
page = virt_to_head_page(object);
- BUG_ON(!page);
if (unlikely(!PageSlab(page)))
return PAGE_SIZE << compound_order(page);
s = page->slab;
- BUG_ON(!s);
+#ifdef CONFIG_SLUB_DEBUG
/*
* Debugging requires use of the padding between object
* and whatever may come after it.
@@ -2630,6 +2628,7 @@ size_t ksize(const void *object)
if (s->flags & (SLAB_RED_ZONE | SLAB_POISON))
return s->objsize;
+#endif
/*
* If we have the need to store the freelist pointer
* back there or track user information then we can
@@ -2637,7 +2636,6 @@ size_t ksize(const void *object)
*/
if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER))
return s->inuse;
-
/*
* Else we can use all the padding etc for the allocation
*/