Commit 95b3692d9c22c659312acb466d0608bf8509f296
Merge branch 'kmemleak' of git://linux-arm.org/linux-2.6
* 'kmemleak' of git://linux-arm.org/linux-2.6: kmemleak: Do not force the slab debugging Kconfig options kmemleak: use pr_fmt
Showing 2 changed files Side-by-side Diff
lib/Kconfig.debug
... | ... | @@ -340,8 +340,6 @@ |
340 | 340 | bool "Kernel memory leak detector" |
341 | 341 | depends on DEBUG_KERNEL && EXPERIMENTAL && (X86 || ARM) && \ |
342 | 342 | !MEMORY_HOTPLUG |
343 | - select DEBUG_SLAB if SLAB | |
344 | - select SLUB_DEBUG if SLUB | |
345 | 343 | select DEBUG_FS if SYSFS |
346 | 344 | select STACKTRACE if STACKTRACE_SUPPORT |
347 | 345 | select KALLSYMS |
... | ... | @@ -354,6 +352,9 @@ |
354 | 352 | feature will introduce an overhead to memory |
355 | 353 | allocations. See Documentation/kmemleak.txt for more |
356 | 354 | details. |
355 | + | |
356 | + Enabling DEBUG_SLAB or SLUB_DEBUG may increase the chances | |
357 | + of finding leaks due to the slab objects poisoning. | |
357 | 358 | |
358 | 359 | In order to access the kmemleak file, debugfs needs to be |
359 | 360 | mounted (usually at /sys/kernel/debug). |
mm/kmemleak.c
... | ... | @@ -61,6 +61,8 @@ |
61 | 61 | * structure. |
62 | 62 | */ |
63 | 63 | |
64 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
65 | + | |
64 | 66 | #include <linux/init.h> |
65 | 67 | #include <linux/kernel.h> |
66 | 68 | #include <linux/list.h> |
... | ... | @@ -311,7 +313,7 @@ |
311 | 313 | |
312 | 314 | static void print_referenced(struct kmemleak_object *object) |
313 | 315 | { |
314 | - pr_info("kmemleak: referenced object 0x%08lx (size %zu)\n", | |
316 | + pr_info("referenced object 0x%08lx (size %zu)\n", | |
315 | 317 | object->pointer, object->size); |
316 | 318 | } |
317 | 319 | |
... | ... | @@ -320,7 +322,7 @@ |
320 | 322 | { |
321 | 323 | int i; |
322 | 324 | |
323 | - print_helper(seq, "kmemleak: unreferenced object 0x%08lx (size %zu):\n", | |
325 | + print_helper(seq, "unreferenced object 0x%08lx (size %zu):\n", | |
324 | 326 | object->pointer, object->size); |
325 | 327 | print_helper(seq, " comm \"%s\", pid %d, jiffies %lu\n", |
326 | 328 | object->comm, object->pid, object->jiffies); |
... | ... | @@ -344,7 +346,7 @@ |
344 | 346 | trace.nr_entries = object->trace_len; |
345 | 347 | trace.entries = object->trace; |
346 | 348 | |
347 | - pr_notice("kmemleak: Object 0x%08lx (size %zu):\n", | |
349 | + pr_notice("Object 0x%08lx (size %zu):\n", | |
348 | 350 | object->tree_node.start, object->size); |
349 | 351 | pr_notice(" comm \"%s\", pid %d, jiffies %lu\n", |
350 | 352 | object->comm, object->pid, object->jiffies); |
... | ... | @@ -372,7 +374,7 @@ |
372 | 374 | object = prio_tree_entry(node, struct kmemleak_object, |
373 | 375 | tree_node); |
374 | 376 | if (!alias && object->pointer != ptr) { |
375 | - kmemleak_warn("kmemleak: Found object by alias"); | |
377 | + kmemleak_warn("Found object by alias"); | |
376 | 378 | object = NULL; |
377 | 379 | } |
378 | 380 | } else |
... | ... | @@ -467,8 +469,7 @@ |
467 | 469 | |
468 | 470 | object = kmem_cache_alloc(object_cache, gfp & GFP_KMEMLEAK_MASK); |
469 | 471 | if (!object) { |
470 | - kmemleak_stop("kmemleak: Cannot allocate a kmemleak_object " | |
471 | - "structure\n"); | |
472 | + kmemleak_stop("Cannot allocate a kmemleak_object structure\n"); | |
472 | 473 | return; |
473 | 474 | } |
474 | 475 | |
... | ... | @@ -527,8 +528,8 @@ |
527 | 528 | if (node != &object->tree_node) { |
528 | 529 | unsigned long flags; |
529 | 530 | |
530 | - kmemleak_stop("kmemleak: Cannot insert 0x%lx into the object " | |
531 | - "search tree (already existing)\n", ptr); | |
531 | + kmemleak_stop("Cannot insert 0x%lx into the object search tree " | |
532 | + "(already existing)\n", ptr); | |
532 | 533 | object = lookup_object(ptr, 1); |
533 | 534 | spin_lock_irqsave(&object->lock, flags); |
534 | 535 | dump_object_info(object); |
... | ... | @@ -553,7 +554,7 @@ |
553 | 554 | write_lock_irqsave(&kmemleak_lock, flags); |
554 | 555 | object = lookup_object(ptr, 0); |
555 | 556 | if (!object) { |
556 | - kmemleak_warn("kmemleak: Freeing unknown object at 0x%08lx\n", | |
557 | + kmemleak_warn("Freeing unknown object at 0x%08lx\n", | |
557 | 558 | ptr); |
558 | 559 | write_unlock_irqrestore(&kmemleak_lock, flags); |
559 | 560 | return; |
... | ... | @@ -588,8 +589,7 @@ |
588 | 589 | |
589 | 590 | object = find_and_get_object(ptr, 0); |
590 | 591 | if (!object) { |
591 | - kmemleak_warn("kmemleak: Graying unknown object at 0x%08lx\n", | |
592 | - ptr); | |
592 | + kmemleak_warn("Graying unknown object at 0x%08lx\n", ptr); | |
593 | 593 | return; |
594 | 594 | } |
595 | 595 | |
... | ... | @@ -610,8 +610,7 @@ |
610 | 610 | |
611 | 611 | object = find_and_get_object(ptr, 0); |
612 | 612 | if (!object) { |
613 | - kmemleak_warn("kmemleak: Blacking unknown object at 0x%08lx\n", | |
614 | - ptr); | |
613 | + kmemleak_warn("Blacking unknown object at 0x%08lx\n", ptr); | |
615 | 614 | return; |
616 | 615 | } |
617 | 616 | |
618 | 617 | |
619 | 618 | |
... | ... | @@ -634,21 +633,20 @@ |
634 | 633 | |
635 | 634 | object = find_and_get_object(ptr, 0); |
636 | 635 | if (!object) { |
637 | - kmemleak_warn("kmemleak: Adding scan area to unknown " | |
638 | - "object at 0x%08lx\n", ptr); | |
636 | + kmemleak_warn("Adding scan area to unknown object at 0x%08lx\n", | |
637 | + ptr); | |
639 | 638 | return; |
640 | 639 | } |
641 | 640 | |
642 | 641 | area = kmem_cache_alloc(scan_area_cache, gfp & GFP_KMEMLEAK_MASK); |
643 | 642 | if (!area) { |
644 | - kmemleak_warn("kmemleak: Cannot allocate a scan area\n"); | |
643 | + kmemleak_warn("Cannot allocate a scan area\n"); | |
645 | 644 | goto out; |
646 | 645 | } |
647 | 646 | |
648 | 647 | spin_lock_irqsave(&object->lock, flags); |
649 | 648 | if (offset + length > object->size) { |
650 | - kmemleak_warn("kmemleak: Scan area larger than object " | |
651 | - "0x%08lx\n", ptr); | |
649 | + kmemleak_warn("Scan area larger than object 0x%08lx\n", ptr); | |
652 | 650 | dump_object_info(object); |
653 | 651 | kmem_cache_free(scan_area_cache, area); |
654 | 652 | goto out_unlock; |
... | ... | @@ -677,8 +675,7 @@ |
677 | 675 | |
678 | 676 | object = find_and_get_object(ptr, 0); |
679 | 677 | if (!object) { |
680 | - kmemleak_warn("kmemleak: Not scanning unknown object at " | |
681 | - "0x%08lx\n", ptr); | |
678 | + kmemleak_warn("Not scanning unknown object at 0x%08lx\n", ptr); | |
682 | 679 | return; |
683 | 680 | } |
684 | 681 | |
... | ... | @@ -699,7 +696,7 @@ |
699 | 696 | struct early_log *log; |
700 | 697 | |
701 | 698 | if (crt_early_log >= ARRAY_SIZE(early_log)) { |
702 | - kmemleak_stop("kmemleak: Early log buffer exceeded\n"); | |
699 | + kmemleak_stop("Early log buffer exceeded\n"); | |
703 | 700 | return; |
704 | 701 | } |
705 | 702 | |
... | ... | @@ -966,7 +963,7 @@ |
966 | 963 | * 1 reference to any object at this point. |
967 | 964 | */ |
968 | 965 | if (atomic_read(&object->use_count) > 1) { |
969 | - pr_debug("kmemleak: object->use_count = %d\n", | |
966 | + pr_debug("object->use_count = %d\n", | |
970 | 967 | atomic_read(&object->use_count)); |
971 | 968 | dump_object_info(object); |
972 | 969 | } |
... | ... | @@ -1062,7 +1059,7 @@ |
1062 | 1059 | { |
1063 | 1060 | static int first_run = 1; |
1064 | 1061 | |
1065 | - pr_info("kmemleak: Automatic memory scanning thread started\n"); | |
1062 | + pr_info("Automatic memory scanning thread started\n"); | |
1066 | 1063 | |
1067 | 1064 | /* |
1068 | 1065 | * Wait before the first scan to allow the system to fully initialize. |
... | ... | @@ -1108,7 +1105,7 @@ |
1108 | 1105 | timeout = schedule_timeout_interruptible(timeout); |
1109 | 1106 | } |
1110 | 1107 | |
1111 | - pr_info("kmemleak: Automatic memory scanning thread ended\n"); | |
1108 | + pr_info("Automatic memory scanning thread ended\n"); | |
1112 | 1109 | |
1113 | 1110 | return 0; |
1114 | 1111 | } |
... | ... | @@ -1123,7 +1120,7 @@ |
1123 | 1120 | return; |
1124 | 1121 | scan_thread = kthread_run(kmemleak_scan_thread, NULL, "kmemleak"); |
1125 | 1122 | if (IS_ERR(scan_thread)) { |
1126 | - pr_warning("kmemleak: Failed to create the scan thread\n"); | |
1123 | + pr_warning("Failed to create the scan thread\n"); | |
1127 | 1124 | scan_thread = NULL; |
1128 | 1125 | } |
1129 | 1126 | } |
... | ... | @@ -1367,7 +1364,7 @@ |
1367 | 1364 | cleanup_thread = kthread_run(kmemleak_cleanup_thread, NULL, |
1368 | 1365 | "kmemleak-clean"); |
1369 | 1366 | if (IS_ERR(cleanup_thread)) |
1370 | - pr_warning("kmemleak: Failed to create the clean-up thread\n"); | |
1367 | + pr_warning("Failed to create the clean-up thread\n"); | |
1371 | 1368 | } |
1372 | 1369 | |
1373 | 1370 | /* |
... | ... | @@ -1488,8 +1485,7 @@ |
1488 | 1485 | dentry = debugfs_create_file("kmemleak", S_IRUGO, NULL, NULL, |
1489 | 1486 | &kmemleak_fops); |
1490 | 1487 | if (!dentry) |
1491 | - pr_warning("kmemleak: Failed to create the debugfs kmemleak " | |
1492 | - "file\n"); | |
1488 | + pr_warning("Failed to create the debugfs kmemleak file\n"); | |
1493 | 1489 | mutex_lock(&kmemleak_mutex); |
1494 | 1490 | start_scan_thread(); |
1495 | 1491 | mutex_unlock(&kmemleak_mutex); |