LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH -next] mm/kmemleak: record the current memory pool size
@ 2019-08-14 19:07 Qian Cai
  2019-08-15 10:02 ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: Qian Cai @ 2019-08-14 19:07 UTC (permalink / raw)
  To: akpm; +Cc: catalin.marinas, linux-mm, linux-kernel, Qian Cai

The only way to obtain the current memory pool size for a running kernel
is to check back the kernel config file which is inconvenient. Record it
in the kernel messages.

Signed-off-by: Qian Cai <cai@lca.pw>
---
 mm/kmemleak.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index b8bbe9ac5472..1f74f8bcb4eb 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1967,7 +1967,8 @@ static int __init kmemleak_late_init(void)
 		mutex_unlock(&scan_mutex);
 	}
 
-	pr_info("Kernel memory leak detector initialized\n");
+	pr_info("Kernel memory leak detector initialized (mem pool size: %d)\n",
+		mem_pool_free_count);
 
 	return 0;
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] mm/kmemleak: record the current memory pool size
  2019-08-14 19:07 [PATCH -next] mm/kmemleak: record the current memory pool size Qian Cai
@ 2019-08-15 10:02 ` Catalin Marinas
  2019-09-20 23:22   ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Catalin Marinas @ 2019-08-15 10:02 UTC (permalink / raw)
  To: Qian Cai; +Cc: akpm, linux-mm, linux-kernel

On Wed, Aug 14, 2019 at 03:07:11PM -0400, Qian Cai wrote:
> The only way to obtain the current memory pool size for a running kernel
> is to check back the kernel config file which is inconvenient. Record it
> in the kernel messages.
> 
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
>  mm/kmemleak.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index b8bbe9ac5472..1f74f8bcb4eb 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -1967,7 +1967,8 @@ static int __init kmemleak_late_init(void)
>  		mutex_unlock(&scan_mutex);
>  	}
>  
> -	pr_info("Kernel memory leak detector initialized\n");
> +	pr_info("Kernel memory leak detector initialized (mem pool size: %d)\n",
> +		mem_pool_free_count);

I wouldn't actually call it the "memory pool size" as I see the size as
a constant set at config time. What about "memory pool available"?

(even this one is not entirely accurate since we have a
mem_pool_free_list but I expect such list not to have too many elements
at the late_initcall time)

If you change the printed string:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] mm/kmemleak: record the current memory pool size
  2019-08-15 10:02 ` Catalin Marinas
@ 2019-09-20 23:22   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2019-09-20 23:22 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: Qian Cai, linux-mm, linux-kernel

On Thu, 15 Aug 2019 11:02:16 +0100 Catalin Marinas <catalin.marinas@arm.com> wrote:

> On Wed, Aug 14, 2019 at 03:07:11PM -0400, Qian Cai wrote:
> > The only way to obtain the current memory pool size for a running kernel
> > is to check back the kernel config file which is inconvenient. Record it
> > in the kernel messages.
> > 
> > Signed-off-by: Qian Cai <cai@lca.pw>
> > ---
> >  mm/kmemleak.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> > index b8bbe9ac5472..1f74f8bcb4eb 100644
> > --- a/mm/kmemleak.c
> > +++ b/mm/kmemleak.c
> > @@ -1967,7 +1967,8 @@ static int __init kmemleak_late_init(void)
> >  		mutex_unlock(&scan_mutex);
> >  	}
> >  
> > -	pr_info("Kernel memory leak detector initialized\n");
> > +	pr_info("Kernel memory leak detector initialized (mem pool size: %d)\n",
> > +		mem_pool_free_count);
> 
> I wouldn't actually call it the "memory pool size" as I see the size as
> a constant set at config time. What about "memory pool available"?
> 
> (even this one is not entirely accurate since we have a
> mem_pool_free_list but I expect such list not to have too many elements
> at the late_initcall time)
> 
> If you change the printed string:
> 
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>

--- a/mm/kmemleak.c~mm-kmemleak-record-the-current-memory-pool-size-fix
+++ a/mm/kmemleak.c
@@ -1967,7 +1967,7 @@ static int __init kmemleak_late_init(voi
 		mutex_unlock(&scan_mutex);
 	}
 
-	pr_info("Kernel memory leak detector initialized (mem pool size: %d)\n",
+	pr_info("Kernel memory leak detector initialized (mem pool available: %d)\n",
 		mem_pool_free_count);
 
 	return 0;
_


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14 19:07 [PATCH -next] mm/kmemleak: record the current memory pool size Qian Cai
2019-08-15 10:02 ` Catalin Marinas
2019-09-20 23:22   ` Andrew Morton

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox