BUG_ON() Conversion in mm/slab.c
Subsystems (2)
PATCH 5/7 BUG_ON() Conversion in mm/slab.c
hi,
this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away.
Signed-off-by Eric Sesterhenn <[email protected]>
mm/slab.c renamed from mm/slab.c.orig +8 -16
@@ -1058,8 +1058,7 @@ void __init kmem_cache_init(void)cache_estimate (0 , cache_cache.objsize,cache_line_size (),0 , &left_over, &cache_cache.num); -if (!cache_cache.num) -BUG (); +BUG_ON (!cache_cache.num); cache_cache.colour = left_over / cache_cache.colour_off; cache_cache.colour_next =0 ;
@@ -1650,8 +1649,7 @@ kmem_cache_create (const char *name, siz* Always checks flags, a caller might be expecting debug * support which isn't available. */ -if (flags & ~CREATE_MASK ) -BUG (); +BUG_ON (flags & ~CREATE_MASK );/* Check that size is in terms of words. This is needed to avoid * unaligned accesses for some archs when redzoning is used, and makes
@@ -1966,8 +1964,7 @@ static int __node_shrink(kmem_cache_t *c slabp = list_entry(l3->slabs_free.prev, struct slab, list);#if DEBUG -if (slabp->inuse) -BUG (); +BUG_ON (slabp->inuse);#endif list_del (&slabp->list);
@@ -2008,8 +2005,7 @@ static int __cache_shrink(kmem_cache_t **/ int kmem_cache_shrink (kmem_cache_t *cachep) { -if (!cachep ||in_interrupt ()) -BUG (); +BUG_ON (!cachep ||in_interrupt ());return __cache_shrink (cachep); }
@@ -2037,8 +2033,7 @@ int kmem_cache_destroy(kmem_cache_t *cacint i;struct kmem_list3 *l3; -if (!cachep ||in_interrupt ()) -BUG (); +BUG_ON (!cachep ||in_interrupt ());/* Don't let CPUs to come and go */ lock_cpu_hotplug ();
@@ -2161,11 +2156,9 @@ static void cache_init_objs(kmem_cache_tstatic void kmem_flagcheck (kmem_cache_t *cachep,gfp_t flags) {if (flags &SLAB_DMA ) { -if (!(cachep->gfpflags &GFP_DMA )) -BUG (); +BUG_ON (!(cachep->gfpflags &GFP_DMA )); }else { -if (cachep->gfpflags &GFP_DMA ) -BUG (); +BUG_ON (cachep->gfpflags &GFP_DMA ); } }
@@ -2200,8 +2193,7 @@ static int cache_grow(kmem_cache_t *cach/* Be lazy and only check for valid flags here, * keeping it out of the critical path in kmem_cache_alloc(). */ -if (flags & ~(SLAB_DMA |SLAB_LEVEL_MASK |SLAB_NO_GROW )) -BUG (); +BUG_ON (flags & ~(SLAB_DMA |SLAB_LEVEL_MASK |SLAB_NO_GROW ));if (flags &SLAB_NO_GROW )return 0 ;
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors