2.4-ac: BUG_ON (2/2)
Subsystems (5)
PATCH 1/1 2.4-ac: BUG_ON (2/2)
Alan,
This patch, which requires the previous BUG_ON part 1 patch, changes a few uses of BUG -> BUG_ON in fast paths in the kernel, partly to demonstrate readability, partly for the optimization, mostly to give a reason to take part 1. ;)
This is a separate patch from the Marcelo variant as part 2 does not apply cleanly to your tree due to various changes.
Patch is against 2.4.19-pre4-ac3, please apply.
Robert Love
arch/i386/kernel/smp.c +1 -2
@@ -301,8 +301,7 @@*/ static void inline leave_mm (unsigned long cpu) { -if (cpu_tlbstate[cpu].state ==TLBSTATE_OK ) -BUG (); +BUG_ON (cpu_tlbstate[cpu].state ==TLBSTATE_OK );clear_bit (cpu, &cpu_tlbstate[cpu].active_mm->cpu_vm_mask); }
kernel/exit.c +1 -1
@@ -362,7 +362,7 @@mm_release ();if (mm) {atomic_inc (&mm->mm_count); -if (mm != tsk->active_mm)BUG (); +BUG_ON (mm != tsk->active_mm);/* more a memory barrier than a real lock */ task_lock (tsk); tsk->mm =NULL ;
kernel/fork.c +1 -1
@@ -275,7 +275,7 @@*/ inline void __mmdrop (struct mm_struct *mm) { -if (mm == &init_mm)BUG (); +BUG_ON (mm == &init_mm);pgd_free (mm->pgd);destroy_context (mm);free_mm (mm);
kernel/sched.c +2 -2
@@ -749,8 +749,8 @@list_t *queue;int idx; -if (unlikely (in_interrupt ())) -BUG (); +BUG_ON (in_interrupt ()); +release_kernel_lock (prev,smp_processor_id ()); prev->sleep_timestamp = jiffies;spin_lock_irq (&rq->lock);
mm/rmap.c +5 -10
@@ -136,8 +136,7 @@ {struct pte_chain * pc, * prev_pc =NULL ; -if (!page || !ptep) -BUG (); +BUG_ON (!page || !ptep);if (!VALID_PAGE (page) ||PageReserved (page))return ;
@@ -186,8 +185,7 @@pte_t pte;int ret; -if (!mm) -BUG (); +BUG_ON (!mm);/* * We need the page_table_lock to protect us from page faults,
@@ -255,13 +253,10 @@int ret =SWAP_SUCCESS ;/* This page should not be on the pageout lists. */ -if (!VALID_PAGE (page) ||PageReserved (page)) -BUG (); -if (!PageLocked (page)) -BUG (); +BUG_ON (!VALID_PAGE (page) ||PageReserved (page)); +BUG_ON (!PageLocked (page));/* We need backing store to swap out a page. */ -if (!page->mapping) -BUG (); +BUG_ON (!page->mapping);for (pc = page->pte_chain; pc; pc = next_pc) { next_pc = pc->next;
mm/slab.c +1 -2
@@ -666,8 +666,7 @@* Always checks flags, a caller might be expecting debug * support which isn't available. */ -if (flags & ~CREATE_MASK ) -BUG (); +BUG_ON (flags & ~CREATE_MASK );/* Get cache's description obj. */ cachep = (kmem_cache_t *)kmem_cache_alloc (&cache_cache,SLAB_KERNEL );