Skip to contentSkip to conversation

BUG_ON() Conversion in mm/vmalloc.c

PATCH In review Eric Sesterhenn / snakebyte 2 participants 3 messages Jan 31, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 7/7 BUG_ON() Conversion in mm/vmalloc.c

hi,

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

mm/vmalloc.c renamed from mm/vmalloc.c.orig +1 -2
@@ -321,8 +321,7 @@ void __vunmap(void *addr, int deallocate
 		int i;
 
 		for (i = 0; i < area->nr_pages; i++) {
-			if (unlikely(!area->pages[i]))
-				BUG();
+			BUG_ON(unlikely(!area->pages[i]));
 			__free_page(area->pages[i]);
 		}
 

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 10 lines · Eric Sesterhenn / snakebyte

hi,

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

mm/vmalloc.c void __vunmap(void *addr, int deallocate · line 324

Quoted 7 lines
mm/vmalloc.c renamed from mm/vmalloc.c.orig +1 -2
@@ -321,8 +321,7 @@ void __vunmap(void *addr, int deallocate
 		int i;
 
 		for (i = 0; i < area->nr_pages; i++) {
-			if (unlikely(!area->pages[i]))
-				BUG();
+			BUG_ON(unlikely(!area->pages[i]));
...

You can drop the unlikely.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Eric Sesterhenn / snakebyte

hi,

Quoted 6 lines

Review

Quoted 4 lines
(quoted diff) +1 -2
-			if (unlikely(!area->pages[i]))
-				BUG();
+			BUG_ON(unlikely(!area->pages[i]));
...

You can drop the unlikely.

of course... thanks.
Here is an updated patch

mm/vmalloc.c renamed from mm/vmalloc.c.orig +1 -2
@@ -321,8 +321,7 @@ void __vunmap(void *addr, int deallocate
 		int i;
 
 		for (i = 0; i < area->nr_pages; i++) {
-			if (unlikely(!area->pages[i]))
-				BUG();
+			BUG_ON(!area->pages[i]);
 			__free_page(area->pages[i]);
 		}
 

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors