diff options
author | Sri Krishna chowdary <schowdary@nvidia.com> | 2018-12-28 03:38:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-28 15:11:51 -0500 |
commit | d53ce042277a94eadf9a8a31fc41fac54c67dec5 (patch) | |
tree | 3da438e716f60f459fead3af0ef0279ad80778c2 /mm | |
parent | 3c0c12cc8f00ca5f81acb010023b8eb13e9a7004 (diff) |
kmemleak: add config to select auto scan
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.
Link: http://lkml.kernel.org/r/1540231723-7087-1-git-send-email-prpatel@nvidia.com
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Signed-off-by: Sachin Nikam <snikam@nvidia.com>
Signed-off-by: Prateek <prpatel@nvidia.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/kmemleak.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 9c3d2dea0861..f9d9dc250428 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -1650,7 +1650,7 @@ static void kmemleak_scan(void) | |||
1650 | */ | 1650 | */ |
1651 | static int kmemleak_scan_thread(void *arg) | 1651 | static int kmemleak_scan_thread(void *arg) |
1652 | { | 1652 | { |
1653 | static int first_run = 1; | 1653 | static int first_run = IS_ENABLED(CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN); |
1654 | 1654 | ||
1655 | pr_info("Automatic memory scanning thread started\n"); | 1655 | pr_info("Automatic memory scanning thread started\n"); |
1656 | set_user_nice(current, 10); | 1656 | set_user_nice(current, 10); |
@@ -2144,9 +2144,11 @@ static int __init kmemleak_late_init(void) | |||
2144 | return -ENOMEM; | 2144 | return -ENOMEM; |
2145 | } | 2145 | } |
2146 | 2146 | ||
2147 | mutex_lock(&scan_mutex); | 2147 | if (IS_ENABLED(CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN)) { |
2148 | start_scan_thread(); | 2148 | mutex_lock(&scan_mutex); |
2149 | mutex_unlock(&scan_mutex); | 2149 | start_scan_thread(); |
2150 | mutex_unlock(&scan_mutex); | ||
2151 | } | ||
2150 | 2152 | ||
2151 | pr_info("Kernel memory leak detector initialized\n"); | 2153 | pr_info("Kernel memory leak detector initialized\n"); |
2152 | 2154 | ||