aboutsummaryrefslogtreecommitdiffstats
path: root/mm/kmemleak.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2011-09-28 12:22:56 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2011-12-02 11:12:42 -0500
commitb66930052abf2e41b8a978ae265303917cbe6fa0 (patch)
treebedb2569b18cb11e9cb1b0a41e7ddb6575ba5e51 /mm/kmemleak.c
parent5f79020cb9fea59a5d4d1712bcd320523b129b35 (diff)
kmemleak: When the early log buffer is exceeded, report the actual number
Just telling that the early log buffer has been exceeded doesn't mean much. This patch moves the error printing to the kmemleak_init() function and displays the actual calls to the kmemleak API during early logging. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'mm/kmemleak.c')
-rw-r--r--mm/kmemleak.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 8b528e3f8413..e8c905b70aa8 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -797,9 +797,13 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
797 unsigned long flags; 797 unsigned long flags;
798 struct early_log *log; 798 struct early_log *log;
799 799
800 if (atomic_read(&kmemleak_error)) {
801 /* kmemleak stopped recording, just count the requests */
802 crt_early_log++;
803 return;
804 }
805
800 if (crt_early_log >= ARRAY_SIZE(early_log)) { 806 if (crt_early_log >= ARRAY_SIZE(early_log)) {
801 pr_warning("Early log buffer exceeded, "
802 "please increase DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n");
803 kmemleak_disable(); 807 kmemleak_disable();
804 return; 808 return;
805 } 809 }
@@ -1634,7 +1638,6 @@ static void kmemleak_disable(void)
1634 return; 1638 return;
1635 1639
1636 /* stop any memory operation tracing */ 1640 /* stop any memory operation tracing */
1637 atomic_set(&kmemleak_early_log, 0);
1638 atomic_set(&kmemleak_enabled, 0); 1641 atomic_set(&kmemleak_enabled, 0);
1639 1642
1640 /* check whether it is too early for a kernel thread */ 1643 /* check whether it is too early for a kernel thread */
@@ -1694,12 +1697,18 @@ void __init kmemleak_init(void)
1694 scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE); 1697 scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE);
1695 INIT_PRIO_TREE_ROOT(&object_tree_root); 1698 INIT_PRIO_TREE_ROOT(&object_tree_root);
1696 1699
1700 if (crt_early_log >= ARRAY_SIZE(early_log))
1701 pr_warning("Early log buffer exceeded (%d), please increase "
1702 "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log);
1703
1697 /* the kernel is still in UP mode, so disabling the IRQs is enough */ 1704 /* the kernel is still in UP mode, so disabling the IRQs is enough */
1698 local_irq_save(flags); 1705 local_irq_save(flags);
1699 if (!atomic_read(&kmemleak_error)) { 1706 atomic_set(&kmemleak_early_log, 0);
1707 if (atomic_read(&kmemleak_error)) {
1708 local_irq_restore(flags);
1709 return;
1710 } else
1700 atomic_set(&kmemleak_enabled, 1); 1711 atomic_set(&kmemleak_enabled, 1);
1701 atomic_set(&kmemleak_early_log, 0);
1702 }
1703 local_irq_restore(flags); 1712 local_irq_restore(flags);
1704 1713
1705 /* 1714 /*