]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.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)
committerIshan Mittal <imittal@nvidia.com>
Fri, 1 Apr 2016 05:53:34 +0000 (11:23 +0530)
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>
Reviewed-on: http://git-master/r/1115945
Reviewed-by: Vandana Salve <vsalve@nvidia.com>
Tested-by: Vandana Salve <vsalve@nvidia.com>
lib/Kconfig.debug
mm/kmemleak.c

index ccac5c83cb836afdb604881bae4827518db9a88e..ac5e7206fcbf8e69a305a812ede3592a003b72bf 100644 (file)
@@ -544,6 +544,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_STACK_USAGE
        bool "Stack utilization instrumentation"
        depends on DEBUG_KERNEL && !IA64 && !PARISC && !METAG
index 19423a45d7d7d96de3b403c60806d14b37788331..23ad87c38ccb1ce964f2209373dc65a8de0dfd90 100644 (file)
@@ -1481,6 +1481,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.
         */
@@ -1488,6 +1489,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;
@@ -1962,9 +1964,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");