kmemleak: Add config to select auto scan
Subsystems (4)
PATCH v2 1/1 kmemleak: Add config to select auto scan
From: Sri Krishna chowdary <[email protected]>
Kmemleak scan can be cpu intensive and can stall user tasks at times. To prevent this, add config DEBUG_KMEMLEAK_AUTO_SCAN to enable/disable auto scan on boot up.
Also protect first_run with DEBUG_KMEMLEAK_AUTO_SCAN as this is meant for only first automatic scan.
---
v2:
* change config name to DEBUG_KMEMLEAK_AUTO_SCAN from DEBUG_KMEMLEAK_SCAN_ON
* use IS_ENABLED(...) instead of #ifdef ...
* update commit message according to config name
--- lib/Kconfig.debug | 15 +++++++++++++++ mm/kmemleak.c | 10 ++++++---- 2 files changed, 21 insertions(+), 4 deletions(-)
lib/Kconfig.debug +15 -0
@@ -593,6 +593,21 @@ 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_AUTO_SCAN + bool "Enable kmemleak auto scan thread on boot up" + default y + depends on DEBUG_KMEMLEAK + help + Depending on the cpu, kmemleak scan may be cpu intensive and can + stall user tasks at times. This option enables/disables automatic + kmemleak scan at boot up. + + Say N here to disable kmemleak auto scan thread to stop automatic + scanning. Disabling this option disables automatic reporting of + memory leaks. + + If unsure, say Y. + config DEBUG_STACK_USAGE bool "Stack utilization instrumentation" depends on DEBUG_KERNEL && !IA64
mm/kmemleak.c +6 -4
@@ -1647,7 +1647,7 @@ static void kmemleak_scan(void)*/ static int kmemleak_scan_thread (void *arg) { -static int first_run =1 ; +static int first_run =IS_ENABLED (CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN );pr_info ("Automatic memory scanning thread started\n" );set_user_nice (current,10 );
@@ -2141,9 +2141,11 @@ static int __init kmemleak_late_init(void)return -ENOMEM ; } -mutex_lock (&scan_mutex); -start_scan_thread (); -mutex_unlock (&scan_mutex); +if (IS_ENABLED (CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN )) { +mutex_lock (&scan_mutex); +start_scan_thread (); +mutex_unlock (&scan_mutex); + }pr_info ("Kernel memory leak detector initialized\n" );
Signature · 1 line
2.1.4
Quoted 11 lines · Prateek Patel
From: Sri Krishna chowdary <[email protected]>
Kmemleak scan can be cpu intensive and can stall user tasks at times. To prevent this, add config
DEBUG_KMEMLEAK_AUTO_SCANto enable/disable auto scan on boot up.
Also protectfirst_runwithDEBUG_KMEMLEAK_AUTO_SCANas this is meant for only first automatic scan.Signed-off-by Sri Krishna chowdary <[email protected]>Signed-off-by Sachin Nikam <[email protected]>Signed-off-by Prateek <[email protected]>
Looks fine to me.
Hi Catalin,
Can you mark this patch as acknowledged so that it can be picked up by the maintainer.
Adding Andrew.
Thanks,
Quoted 15 lines · Catalin Marinas
Quoted 11 lines · Prateek Patel
From: Sri Krishna chowdary <[email protected]>
Kmemleak scan can be cpu intensive and can stall user tasks at times. To prevent this, add config
DEBUG_KMEMLEAK_AUTO_SCANto enable/disable auto scan on boot up.
Also protectfirst_runwithDEBUG_KMEMLEAK_AUTO_SCANas this is meant for only first automatic scan.Signed-off-by Sri Krishna chowdary <[email protected]>Signed-off-by Sachin Nikam <[email protected]>Signed-off-by Prateek <[email protected]>Looks fine to me.
Reviewed-by Catalin Marinas <[email protected]>
Quoted 13 lines · Prateek Patel
Quoted 12 lines · Catalin Marinas
Quoted 11 lines · Prateek Patel
From: Sri Krishna chowdary <[email protected]>
Kmemleak scan can be cpu intensive and can stall user tasks at times. To prevent this, add config
DEBUG_KMEMLEAK_AUTO_SCANto enable/disable auto scan on boot up.
Also protectfirst_runwithDEBUG_KMEMLEAK_AUTO_SCANas this is meant for only first automatic scan.Signed-off-by Sri Krishna chowdary <[email protected]>Signed-off-by Sachin Nikam <[email protected]>Signed-off-by Prateek <[email protected]>
Quoted 6 lines
Quoted 3 lines
Looks fine to me.
Reviewed-by Catalin Marinas <[email protected]>Can you mark this patch as acknowledged so that it can be picked up by the maintainer.
I thought Reviewed-by was sufficient. Anyway: