diff options
author | Christoph Lameter <clameter@sgi.com> | 2008-02-16 02:45:25 -0500 |
---|---|---|
committer | Christoph Lameter <clameter@sgi.com> | 2008-03-03 15:22:31 -0500 |
commit | ae20bfda6813387af18c7fdbc0f8b1fa7be2d05b (patch) | |
tree | 4455ba4cdd5a7bd1d3da13915965f1aed2dd84b0 /mm/slub.c | |
parent | 27d9e4e94862c89d171cf70911b4f11ad69fb54e (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/slub.c')
-rw-r--r-- | mm/slub.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -2610,19 +2610,17 @@ size_t ksize(const void *object) | |||
2610 | struct page *page; | 2610 | struct page *page; |
2611 | struct kmem_cache *s; | 2611 | struct kmem_cache *s; |
2612 | 2612 | ||
2613 | BUG_ON(!object); | ||
2614 | if (unlikely(object == ZERO_SIZE_PTR)) | 2613 | if (unlikely(object == ZERO_SIZE_PTR)) |
2615 | return 0; | 2614 | return 0; |
2616 | 2615 | ||
2617 | page = virt_to_head_page(object); | 2616 | page = virt_to_head_page(object); |
2618 | BUG_ON(!page); | ||
2619 | 2617 | ||
2620 | if (unlikely(!PageSlab(page))) | 2618 | if (unlikely(!PageSlab(page))) |
2621 | return PAGE_SIZE << compound_order(page); | 2619 | return PAGE_SIZE << compound_order(page); |
2622 | 2620 | ||
2623 | s = page->slab; | 2621 | s = page->slab; |
2624 | BUG_ON(!s); | ||
2625 | 2622 | ||
2623 | #ifdef CONFIG_SLUB_DEBUG | ||
2626 | /* | 2624 | /* |
2627 | * Debugging requires use of the padding between object | 2625 | * Debugging requires use of the padding between object |
2628 | * and whatever may come after it. | 2626 | * and whatever may come after it. |
@@ -2630,6 +2628,7 @@ size_t ksize(const void *object) | |||
2630 | if (s->flags & (SLAB_RED_ZONE | SLAB_POISON)) | 2628 | if (s->flags & (SLAB_RED_ZONE | SLAB_POISON)) |
2631 | return s->objsize; | 2629 | return s->objsize; |
2632 | 2630 | ||
2631 | #endif | ||
2633 | /* | 2632 | /* |
2634 | * If we have the need to store the freelist pointer | 2633 | * If we have the need to store the freelist pointer |
2635 | * back there or track user information then we can | 2634 | * back there or track user information then we can |
@@ -2637,7 +2636,6 @@ size_t ksize(const void *object) | |||
2637 | */ | 2636 | */ |
2638 | if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER)) | 2637 | if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER)) |
2639 | return s->inuse; | 2638 | return s->inuse; |
2640 | |||
2641 | /* | 2639 | /* |
2642 | * Else we can use all the padding etc for the allocation | 2640 | * Else we can use all the padding etc for the allocation |
2643 | */ | 2641 | */ |