* [PATCH V2] kmemleak: Add config to select auto scan
@ 2018-10-22 18:08 ` Prateek Patel
0 siblings, 0 replies; 6+ messages in thread
From: Prateek Patel @ 2018-10-22 18:08 UTC (permalink / raw)
To: catalin.marinas
Cc: linux-kernel, linux-mm, linux-tegra, snikam, vdumpa, talho,
swarren, prpatel, Sri Krishna chowdary
From: Sri Krishna chowdary <schowdary@nvidia.com>
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.
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Signed-off-by: Sachin Nikam <snikam@nvidia.com>
Signed-off-by: Prateek <prpatel@nvidia.com>
---
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(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c958013..a14166d 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -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
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 877de4f..a614930 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -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");
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2] kmemleak: Add config to select auto scan
@ 2018-10-22 18:08 ` Prateek Patel
0 siblings, 0 replies; 6+ messages in thread
From: Prateek Patel @ 2018-10-22 18:08 UTC (permalink / raw)
To: catalin.marinas
Cc: linux-kernel, linux-mm, linux-tegra, snikam, vdumpa, talho,
swarren, prpatel, Sri Krishna chowdary
From: Sri Krishna chowdary <schowdary@nvidia.com>
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.
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Signed-off-by: Sachin Nikam <snikam@nvidia.com>
Signed-off-by: Prateek <prpatel@nvidia.com>
---
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(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c958013..a14166d 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -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
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 877de4f..a614930 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -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");
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2] kmemleak: Add config to select auto scan
2018-10-22 18:08 ` Prateek Patel
(?)
@ 2018-10-29 10:43 ` Catalin Marinas
2018-12-12 6:44 ` Prateek Patel
-1 siblings, 1 reply; 6+ messages in thread
From: Catalin Marinas @ 2018-10-29 10:43 UTC (permalink / raw)
To: Prateek Patel
Cc: linux-kernel, linux-mm, linux-tegra, snikam, vdumpa, talho,
swarren, Sri Krishna chowdary
On Mon, Oct 22, 2018 at 11:38:43PM +0530, Prateek Patel wrote:
> From: Sri Krishna chowdary <schowdary@nvidia.com>
>
> 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.
>
> Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
> Signed-off-by: Sachin Nikam <snikam@nvidia.com>
> Signed-off-by: Prateek <prpatel@nvidia.com>
Looks fine to me.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] kmemleak: Add config to select auto scan
2018-10-29 10:43 ` Catalin Marinas
@ 2018-12-12 6:44 ` Prateek Patel
0 siblings, 0 replies; 6+ messages in thread
From: Prateek Patel @ 2018-12-12 6:44 UTC (permalink / raw)
To: Catalin Marinas, Andrew Morton
Cc: linux-kernel, linux-mm, linux-tegra, snikam, vdumpa, talho,
swarren, treding
Hi Catalin,
Can you mark this patch as acknowledged so that it can be picked up by
the maintainer.
Adding Andrew.
Thanks,
On 10/29/2018 4:13 PM, Catalin Marinas wrote:
> On Mon, Oct 22, 2018 at 11:38:43PM +0530, Prateek Patel wrote:
>> From: Sri Krishna chowdary <schowdary@nvidia.com>
>>
>> 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.
>>
>> Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
>> Signed-off-by: Sachin Nikam <snikam@nvidia.com>
>> Signed-off-by: Prateek <prpatel@nvidia.com>
> Looks fine to me.
>
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] kmemleak: Add config to select auto scan
@ 2018-12-12 6:44 ` Prateek Patel
0 siblings, 0 replies; 6+ messages in thread
From: Prateek Patel @ 2018-12-12 6:44 UTC (permalink / raw)
To: Catalin Marinas, Andrew Morton
Cc: linux-kernel, linux-mm, linux-tegra, snikam, vdumpa, talho,
swarren, treding
Hi Catalin,
Can you mark this patch as acknowledged so that it can be picked up by
the maintainer.
Adding Andrew.
Thanks,
On 10/29/2018 4:13 PM, Catalin Marinas wrote:
> On Mon, Oct 22, 2018 at 11:38:43PM +0530, Prateek Patel wrote:
>> From: Sri Krishna chowdary <schowdary@nvidia.com>
>>
>> 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.
>>
>> Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
>> Signed-off-by: Sachin Nikam <snikam@nvidia.com>
>> Signed-off-by: Prateek <prpatel@nvidia.com>
> Looks fine to me.
>
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] kmemleak: Add config to select auto scan
2018-12-12 6:44 ` Prateek Patel
(?)
@ 2018-12-12 10:14 ` Catalin Marinas
-1 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2018-12-12 10:14 UTC (permalink / raw)
To: Prateek Patel
Cc: Andrew Morton, linux-kernel, linux-mm, linux-tegra, snikam,
vdumpa, talho, swarren, treding
On Wed, Dec 12, 2018 at 12:14:29PM +0530, Prateek Patel wrote:
> On 10/29/2018 4:13 PM, Catalin Marinas wrote:
> > On Mon, Oct 22, 2018 at 11:38:43PM +0530, Prateek Patel wrote:
> > > From: Sri Krishna chowdary <schowdary@nvidia.com>
> > >
> > > 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.
> > >
> > > Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
> > > Signed-off-by: Sachin Nikam <snikam@nvidia.com>
> > > Signed-off-by: Prateek <prpatel@nvidia.com>
> > Looks fine to me.
> >
> > Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
>
> Can you mark this patch as acknowledged so that it can be picked up by the
> maintainer.
I thought Reviewed-by was sufficient. Anyway:
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-12-12 10:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22 18:08 [PATCH V2] kmemleak: Add config to select auto scan Prateek Patel
2018-10-22 18:08 ` Prateek Patel
2018-10-29 10:43 ` Catalin Marinas
2018-12-12 6:44 ` Prateek Patel
2018-12-12 6:44 ` Prateek Patel
2018-12-12 10:14 ` Catalin Marinas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.