BUG_ON() Conversion in mm/slab.c

this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
This commit is contained in:
Eric Sesterhenn 2006-04-02 13:49:25 +02:00 committed by Adrian Bunk
parent 75babcaced
commit 40094fa652
1 changed files with 6 additions and 12 deletions

View File

@ -1297,8 +1297,7 @@ void __init kmem_cache_init(void)
if (cache_cache.num) if (cache_cache.num)
break; break;
} }
if (!cache_cache.num) BUG_ON(!cache_cache.num);
BUG();
cache_cache.gfporder = order; cache_cache.gfporder = order;
cache_cache.colour = left_over / cache_cache.colour_off; cache_cache.colour = left_over / cache_cache.colour_off;
cache_cache.slab_size = ALIGN(cache_cache.num * sizeof(kmem_bufctl_t) + cache_cache.slab_size = ALIGN(cache_cache.num * sizeof(kmem_bufctl_t) +
@ -1974,8 +1973,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
* Always checks flags, a caller might be expecting debug support which * Always checks flags, a caller might be expecting debug support which
* isn't available. * isn't available.
*/ */
if (flags & ~CREATE_MASK) BUG_ON(flags & ~CREATE_MASK);
BUG();
/* /*
* Check that size is in terms of words. This is needed to avoid * Check that size is in terms of words. This is needed to avoid
@ -2206,8 +2204,7 @@ static int __node_shrink(struct kmem_cache *cachep, int node)
slabp = list_entry(l3->slabs_free.prev, struct slab, list); slabp = list_entry(l3->slabs_free.prev, struct slab, list);
#if DEBUG #if DEBUG
if (slabp->inuse) BUG_ON(slabp->inuse);
BUG();
#endif #endif
list_del(&slabp->list); list_del(&slabp->list);
@ -2248,8 +2245,7 @@ static int __cache_shrink(struct kmem_cache *cachep)
*/ */
int kmem_cache_shrink(struct kmem_cache *cachep) int kmem_cache_shrink(struct kmem_cache *cachep)
{ {
if (!cachep || in_interrupt()) BUG_ON(!cachep || in_interrupt());
BUG();
return __cache_shrink(cachep); return __cache_shrink(cachep);
} }
@ -2277,8 +2273,7 @@ int kmem_cache_destroy(struct kmem_cache *cachep)
int i; int i;
struct kmem_list3 *l3; struct kmem_list3 *l3;
if (!cachep || in_interrupt()) BUG_ON(!cachep || in_interrupt());
BUG();
/* Don't let CPUs to come and go */ /* Don't let CPUs to come and go */
lock_cpu_hotplug(); lock_cpu_hotplug();
@ -2477,8 +2472,7 @@ static int cache_grow(struct kmem_cache *cachep, gfp_t flags, int nodeid)
* Be lazy and only check for valid flags here, keeping it out of the * Be lazy and only check for valid flags here, keeping it out of the
* critical path in kmem_cache_alloc(). * critical path in kmem_cache_alloc().
*/ */
if (flags & ~(SLAB_DMA | SLAB_LEVEL_MASK | SLAB_NO_GROW)) BUG_ON(flags & ~(SLAB_DMA | SLAB_LEVEL_MASK | SLAB_NO_GROW));
BUG();
if (flags & SLAB_NO_GROW) if (flags & SLAB_NO_GROW)
return 0; return 0;