]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
kmemleak: Add config to select auto scan
authorSri Krishna chowdary <schowdary@nvidia.com>
Wed, 7 Jan 2015 06:55:16 +0000 (12:25 +0530)
committerSri Krishna Chowdary <schowdary@nvidia.com>
Mon, 12 Jan 2015 06:08:09 +0000 (22:08 -0800)
Add new config DEBUG_KMEMLEAK_SCAN_ON.
Initiate auto scan thread only if the config is enabled.

Bug 200066404

Change-Id: I357634d44a008487e20a62fae9992c94be5efa3f
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/670251
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com>
Reviewed-by: Shridhar Rasal <srasal@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
lib/Kconfig.debug
mm/kmemleak.c

index 60b7b9bd81e821271cb8932ee932262391157f23..167f7bc1f4476857916b4e8a7a9015bc0c80f0cd 100644 (file)
@@ -524,6 +524,14 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF
          Say Y here to disable kmemleak by default. It can then be enabled
          on the command line via kmemleak=on.
 
+config DEBUG_KMEMLEAK_SCAN_ON
+       bool "Enable kmemleak auto scan thread on boot up"
+       default y
+       depends on DEBUG_KMEMLEAK
+       help
+         Kmemleak scan is cpu intensive and can stall user tasks at times.
+         Say N here to disable kmemleak auto scan thread at boot up.
+
 config DEBUG_PREEMPT
        bool "Debug preemptible kernel"
        depends on DEBUG_KERNEL && PREEMPT && TRACE_IRQFLAGS_SUPPORT
index c8d7f3110fd0002cc1c2b85061c163ba7183bfc4..6324ad236cf3c3805367d26bed6dcf11a2db5f88 100644 (file)
@@ -1397,6 +1397,7 @@ static int kmemleak_scan_thread(void *arg)
        pr_info("Automatic memory scanning thread started\n");
        set_user_nice(current, 10);
 
+#ifdef CONFIG_DEBUG_KMEMLEAK_SCAN_ON
        /*
         * Wait before the first scan to allow the system to fully initialize.
         */
@@ -1404,6 +1405,7 @@ static int kmemleak_scan_thread(void *arg)
                first_run = 0;
                ssleep(SECS_FIRST_SCAN);
        }
+#endif
 
        while (!kthread_should_stop()) {
                signed long timeout = jiffies_scan_wait;
@@ -1855,9 +1857,11 @@ static int __init kmemleak_late_init(void)
                                     &kmemleak_fops);
        if (!dentry)
                pr_warning("Failed to create the debugfs kmemleak file\n");
+#ifdef CONFIG_DEBUG_KMEMLEAK_SCAN_ON
        mutex_lock(&scan_mutex);
        start_scan_thread();
        mutex_unlock(&scan_mutex);
+#endif
 
        pr_info("Kernel memory leak detector initialized\n");