summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVignesh Radhakrishnan <vigneshr@codeaurora.org>2015-01-22 11:43:45 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:03:47 -0700
commit12471ac6f8a09d594cbe8c4f0fa4f424eb7d29ac (patch)
tree0e2689b6aae97585af322c22f2f2439f7494d9b8
parentab5d4ae2e4c60e9552b304331f3a05efbc7f3157 (diff)
kmemleak : Make kmemleak_stack_scan optional using config
Currently we have kmemleak_stack_scan enabled by default. This can hog the cpu with pre-emption disabled for a long time starving other tasks. Make this optional at compile time, since if required we can always write to sysfs entry and enable this option. Change-Id: Ie30447861c942337c7ff25ac269b6025a527e8eb Signed-off-by: Vignesh Radhakrishnan <vigneshr@codeaurora.org> Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
-rw-r--r--lib/Kconfig.debug9
-rw-r--r--mm/kmemleak.c12
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 6cbffbdf3911..5a37e2e7bbce 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -919,6 +919,15 @@ config TIMER_STATS
(it defaults to deactivated on bootup and will only be activated
if some application like powertop activates it explicitly).
+config DEBUG_TASK_STACK_SCAN_OFF
+ bool "Disable kmemleak task stack scan by default"
+ depends on DEBUG_KMEMLEAK
+ help
+ Say Y here to disable kmemleak task stack scan by default
+ at compile time. It can be enabled later if required by
+ writing to the debugfs entry :
+ echo "stack=on" > /sys/kernel/debug/kmemleak.
+
config DEBUG_PREEMPT
bool "Debug preemptible kernel"
depends on DEBUG_KERNEL && PREEMPT && TRACE_IRQFLAGS_SUPPORT
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 19423a45d7d7..e5979e423bc2 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -223,8 +223,18 @@ static unsigned long jiffies_min_age;
static unsigned long jiffies_last_scan;
/* delay between automatic memory scannings */
static signed long jiffies_scan_wait;
-/* enables or disables the task stacks scanning */
+
+/* Enables or disables the task stacks scanning.
+ * Set to 1 if at compile time we want it enabled.
+ * Else set to 0 to have it disabled by default.
+ * This can be enabled by writing to "stack=on" using
+ * kmemleak debugfs entry.*/
+#ifdef CONFIG_DEBUG_TASK_STACK_SCAN_OFF
+static int kmemleak_stack_scan;
+#else
static int kmemleak_stack_scan = 1;
+#endif
+
/* protects the memory scanning, parameters and debug/kmemleak file access */
static DEFINE_MUTEX(scan_mutex);
/* setting kmemleak=on, will set this var, skipping the disable */