Merge branch 'kmemleak' of git://linux-arm.org/linux-2.6

* 'kmemleak' of git://linux-arm.org/linux-2.6:
kmemleak: Fix some typos in comments
kmemleak: Rename kmemleak_panic to kmemleak_stop
kmemleak: Only use GFP_KERNEL|GFP_ATOMIC for the internal allocations

+15 -12
+15 -12
mm/kmemleak.c
··· 109 110 #define BYTES_PER_POINTER sizeof(void *) 111 112 /* scanning area inside a memory block */ 113 struct kmemleak_scan_area { 114 struct hlist_node node; ··· 202 static int reported_leaks; 203 204 /* 205 - * Early object allocation/freeing logging. Kkmemleak is initialized after the 206 * kernel allocator. However, both the kernel allocator and kmemleak may 207 - * allocate memory blocks which need to be tracked. Kkmemleak defines an 208 * arbitrary buffer to hold the allocation/freeing information before it is 209 * fully initialized. 210 */ ··· 248 249 /* 250 * Macro invoked when a serious kmemleak condition occured and cannot be 251 - * recovered from. Kkmemleak will be disabled and further allocation/freeing 252 * tracing no longer available. 253 */ 254 - #define kmemleak_panic(x...) do { \ 255 kmemleak_warn(x); \ 256 kmemleak_disable(); \ 257 } while (0) ··· 465 struct prio_tree_node *node; 466 struct stack_trace trace; 467 468 - object = kmem_cache_alloc(object_cache, gfp & ~GFP_SLAB_BUG_MASK); 469 if (!object) { 470 - kmemleak_panic("kmemleak: Cannot allocate a kmemleak_object " 471 - "structure\n"); 472 return; 473 } 474 ··· 527 if (node != &object->tree_node) { 528 unsigned long flags; 529 530 - kmemleak_panic("kmemleak: Cannot insert 0x%lx into the object " 531 - "search tree (already existing)\n", ptr); 532 object = lookup_object(ptr, 1); 533 spin_lock_irqsave(&object->lock, flags); 534 dump_object_info(object); ··· 639 return; 640 } 641 642 - area = kmem_cache_alloc(scan_area_cache, gfp & ~GFP_SLAB_BUG_MASK); 643 if (!area) { 644 kmemleak_warn("kmemleak: Cannot allocate a scan area\n"); 645 goto out; ··· 699 struct early_log *log; 700 701 if (crt_early_log >= ARRAY_SIZE(early_log)) { 702 - kmemleak_panic("kmemleak: Early log buffer exceeded\n"); 703 return; 704 } 705 ··· 1407 early_param("kmemleak", kmemleak_boot_config); 1408 1409 /* 1410 - * Kkmemleak initialization. 1411 */ 1412 void __init kmemleak_init(void) 1413 {
··· 109 110 #define BYTES_PER_POINTER sizeof(void *) 111 112 + /* GFP bitmask for kmemleak internal allocations */ 113 + #define GFP_KMEMLEAK_MASK (GFP_KERNEL | GFP_ATOMIC) 114 + 115 /* scanning area inside a memory block */ 116 struct kmemleak_scan_area { 117 struct hlist_node node; ··· 199 static int reported_leaks; 200 201 /* 202 + * Early object allocation/freeing logging. Kmemleak is initialized after the 203 * kernel allocator. However, both the kernel allocator and kmemleak may 204 + * allocate memory blocks which need to be tracked. Kmemleak defines an 205 * arbitrary buffer to hold the allocation/freeing information before it is 206 * fully initialized. 207 */ ··· 245 246 /* 247 * Macro invoked when a serious kmemleak condition occured and cannot be 248 + * recovered from. Kmemleak will be disabled and further allocation/freeing 249 * tracing no longer available. 250 */ 251 + #define kmemleak_stop(x...) do { \ 252 kmemleak_warn(x); \ 253 kmemleak_disable(); \ 254 } while (0) ··· 462 struct prio_tree_node *node; 463 struct stack_trace trace; 464 465 + object = kmem_cache_alloc(object_cache, gfp & GFP_KMEMLEAK_MASK); 466 if (!object) { 467 + kmemleak_stop("kmemleak: Cannot allocate a kmemleak_object " 468 + "structure\n"); 469 return; 470 } 471 ··· 524 if (node != &object->tree_node) { 525 unsigned long flags; 526 527 + kmemleak_stop("kmemleak: Cannot insert 0x%lx into the object " 528 + "search tree (already existing)\n", ptr); 529 object = lookup_object(ptr, 1); 530 spin_lock_irqsave(&object->lock, flags); 531 dump_object_info(object); ··· 636 return; 637 } 638 639 + area = kmem_cache_alloc(scan_area_cache, gfp & GFP_KMEMLEAK_MASK); 640 if (!area) { 641 kmemleak_warn("kmemleak: Cannot allocate a scan area\n"); 642 goto out; ··· 696 struct early_log *log; 697 698 if (crt_early_log >= ARRAY_SIZE(early_log)) { 699 + kmemleak_stop("kmemleak: Early log buffer exceeded\n"); 700 return; 701 } 702 ··· 1404 early_param("kmemleak", kmemleak_boot_config); 1405 1406 /* 1407 + * Kmemleak initialization. 1408 */ 1409 void __init kmemleak_init(void) 1410 {