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>
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
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.
*/
first_run = 0;
ssleep(SECS_FIRST_SCAN);
}
+#endif
while (!kthread_should_stop()) {
signed long timeout = jiffies_scan_wait;
&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");