All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kmemleak: record accurate early log buffer count and report when exceeded
@ 2015-04-15 11:49 ` Wang Kai
  0 siblings, 0 replies; 9+ messages in thread
From: Wang Kai @ 2015-04-15 11:49 UTC (permalink / raw)
  To: catalin.marinas; +Cc: linux-mm, linux-kernel

In log_early function, crt_early_log should also count once when
'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported
count from kmemleak_init is one less than 'actual number'.

Then, in kmemleak_init, if early_log buffer size equal actual
number, kmemleak will init sucessful, so change warning condition
to 'crt_early_log > ARRAY_SIZE(early_log)'.

Signed-off-by: Wang Kai <morgan.wang@huawei.com>
---
 mm/kmemleak.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 5405aff..49956cf 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -814,6 +814,8 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
 	}
 
 	if (crt_early_log >= ARRAY_SIZE(early_log)) {
+		/* kmemleak will stop recording, just count the requests */
+		crt_early_log++;
 		kmemleak_disable();
 		return;
 	}
@@ -1829,7 +1831,8 @@ void __init kmemleak_init(void)
 	object_cache = KMEM_CACHE(kmemleak_object, SLAB_NOLEAKTRACE);
 	scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE);
 
-	if (crt_early_log >= ARRAY_SIZE(early_log))
+	/* Don't warning when crt_early_log == ARRAY_SIZE(early_log) */
+	if (crt_early_log > ARRAY_SIZE(early_log))
 		pr_warning("Early log buffer exceeded (%d), please increase "
 			   "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log);
 
-- 
1.7.9.5


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

* [PATCH] kmemleak: record accurate early log buffer count and report when exceeded
@ 2015-04-15 11:49 ` Wang Kai
  0 siblings, 0 replies; 9+ messages in thread
From: Wang Kai @ 2015-04-15 11:49 UTC (permalink / raw)
  To: catalin.marinas; +Cc: linux-mm, linux-kernel

In log_early function, crt_early_log should also count once when
'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported
count from kmemleak_init is one less than 'actual number'.

Then, in kmemleak_init, if early_log buffer size equal actual
number, kmemleak will init sucessful, so change warning condition
to 'crt_early_log > ARRAY_SIZE(early_log)'.

Signed-off-by: Wang Kai <morgan.wang@huawei.com>
---
 mm/kmemleak.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 5405aff..49956cf 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -814,6 +814,8 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
 	}
 
 	if (crt_early_log >= ARRAY_SIZE(early_log)) {
+		/* kmemleak will stop recording, just count the requests */
+		crt_early_log++;
 		kmemleak_disable();
 		return;
 	}
@@ -1829,7 +1831,8 @@ void __init kmemleak_init(void)
 	object_cache = KMEM_CACHE(kmemleak_object, SLAB_NOLEAKTRACE);
 	scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE);
 
-	if (crt_early_log >= ARRAY_SIZE(early_log))
+	/* Don't warning when crt_early_log == ARRAY_SIZE(early_log) */
+	if (crt_early_log > ARRAY_SIZE(early_log))
 		pr_warning("Early log buffer exceeded (%d), please increase "
 			   "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log);
 
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] kmemleak: record accurate early log buffer count and report when exceeded
  2015-04-15 11:49 ` Wang Kai
@ 2015-04-15 15:13   ` Catalin Marinas
  -1 siblings, 0 replies; 9+ messages in thread
From: Catalin Marinas @ 2015-04-15 15:13 UTC (permalink / raw)
  To: Wang Kai; +Cc: linux-mm, linux-kernel

(I see you corrected the LKML address; I replied to your early patch)

On Wed, Apr 15, 2015 at 12:49:23PM +0100, Wang Kai wrote:
> In log_early function, crt_early_log should also count once when
> 'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported
> count from kmemleak_init is one less than 'actual number'.
> 
> Then, in kmemleak_init, if early_log buffer size equal actual
> number, kmemleak will init sucessful, so change warning condition
> to 'crt_early_log > ARRAY_SIZE(early_log)'.
> 
> Signed-off-by: Wang Kai <morgan.wang@huawei.com>
> ---
>  mm/kmemleak.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index 5405aff..49956cf 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -814,6 +814,8 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
>  	}
>  
>  	if (crt_early_log >= ARRAY_SIZE(early_log)) {
> +		/* kmemleak will stop recording, just count the requests */

You could say "just count the last request" since kmemleak_disable()
would set kmemleak_error to 1 and you never get to this block again.

> +		crt_early_log++;
>  		kmemleak_disable();
>  		return;
>  	}
> @@ -1829,7 +1831,8 @@ void __init kmemleak_init(void)
>  	object_cache = KMEM_CACHE(kmemleak_object, SLAB_NOLEAKTRACE);
>  	scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE);
>  
> -	if (crt_early_log >= ARRAY_SIZE(early_log))
> +	/* Don't warning when crt_early_log == ARRAY_SIZE(early_log) */

s/warning/warn/

But I don't think this comment is needed, just add it to the commit log.

> +	if (crt_early_log > ARRAY_SIZE(early_log))
>  		pr_warning("Early log buffer exceeded (%d), please increase "
>  			   "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log);

Otherwise, my ack still stands:

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

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

* Re: [PATCH] kmemleak: record accurate early log buffer count and report when exceeded
@ 2015-04-15 15:13   ` Catalin Marinas
  0 siblings, 0 replies; 9+ messages in thread
From: Catalin Marinas @ 2015-04-15 15:13 UTC (permalink / raw)
  To: Wang Kai; +Cc: linux-mm, linux-kernel

(I see you corrected the LKML address; I replied to your early patch)

On Wed, Apr 15, 2015 at 12:49:23PM +0100, Wang Kai wrote:
> In log_early function, crt_early_log should also count once when
> 'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported
> count from kmemleak_init is one less than 'actual number'.
> 
> Then, in kmemleak_init, if early_log buffer size equal actual
> number, kmemleak will init sucessful, so change warning condition
> to 'crt_early_log > ARRAY_SIZE(early_log)'.
> 
> Signed-off-by: Wang Kai <morgan.wang@huawei.com>
> ---
>  mm/kmemleak.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index 5405aff..49956cf 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -814,6 +814,8 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
>  	}
>  
>  	if (crt_early_log >= ARRAY_SIZE(early_log)) {
> +		/* kmemleak will stop recording, just count the requests */

You could say "just count the last request" since kmemleak_disable()
would set kmemleak_error to 1 and you never get to this block again.

> +		crt_early_log++;
>  		kmemleak_disable();
>  		return;
>  	}
> @@ -1829,7 +1831,8 @@ void __init kmemleak_init(void)
>  	object_cache = KMEM_CACHE(kmemleak_object, SLAB_NOLEAKTRACE);
>  	scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE);
>  
> -	if (crt_early_log >= ARRAY_SIZE(early_log))
> +	/* Don't warning when crt_early_log == ARRAY_SIZE(early_log) */

s/warning/warn/

But I don't think this comment is needed, just add it to the commit log.

> +	if (crt_early_log > ARRAY_SIZE(early_log))
>  		pr_warning("Early log buffer exceeded (%d), please increase "
>  			   "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log);

Otherwise, my ack still stands:

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] kmemleak: record accurate early log buffer count and report when exceeded
  2015-04-15 15:13   ` Catalin Marinas
@ 2015-04-15 23:23     ` Wang Kai
  -1 siblings, 0 replies; 9+ messages in thread
From: Wang Kai @ 2015-04-15 23:23 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: linux-mm, linux-kernel

Thanks a lot for the correction.

On 2015/4/15 23:13, Catalin Marinas wrote:
> (I see you corrected the LKML address; I replied to your early patch)
> 
> On Wed, Apr 15, 2015 at 12:49:23PM +0100, Wang Kai wrote:
>> In log_early function, crt_early_log should also count once when
>> 'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported
>> count from kmemleak_init is one less than 'actual number'.
>>
>> Then, in kmemleak_init, if early_log buffer size equal actual
>> number, kmemleak will init sucessful, so change warning condition
>> to 'crt_early_log > ARRAY_SIZE(early_log)'.
>>
>> Signed-off-by: Wang Kai <morgan.wang@huawei.com>
>> ---
>>  mm/kmemleak.c |    5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
>> index 5405aff..49956cf 100644
>> --- a/mm/kmemleak.c
>> +++ b/mm/kmemleak.c
>> @@ -814,6 +814,8 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
>>  	}
>>  
>>  	if (crt_early_log >= ARRAY_SIZE(early_log)) {
>> +		/* kmemleak will stop recording, just count the requests */
> 
> You could say "just count the last request" since kmemleak_disable()
> would set kmemleak_error to 1 and you never get to this block again.
> 
>> +		crt_early_log++;
>>  		kmemleak_disable();
>>  		return;
>>  	}
>> @@ -1829,7 +1831,8 @@ void __init kmemleak_init(void)
>>  	object_cache = KMEM_CACHE(kmemleak_object, SLAB_NOLEAKTRACE);
>>  	scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE);
>>  
>> -	if (crt_early_log >= ARRAY_SIZE(early_log))
>> +	/* Don't warning when crt_early_log == ARRAY_SIZE(early_log) */
> 
> s/warning/warn/
> 
> But I don't think this comment is needed, just add it to the commit log.
> 
>> +	if (crt_early_log > ARRAY_SIZE(early_log))
>>  		pr_warning("Early log buffer exceeded (%d), please increase "
>>  			   "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log);
> 
> Otherwise, my ack still stands:
> 
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
> 
> .
> 



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

* Re: [PATCH] kmemleak: record accurate early log buffer count and report when exceeded
@ 2015-04-15 23:23     ` Wang Kai
  0 siblings, 0 replies; 9+ messages in thread
From: Wang Kai @ 2015-04-15 23:23 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: linux-mm, linux-kernel

Thanks a lot for the correction.

On 2015/4/15 23:13, Catalin Marinas wrote:
> (I see you corrected the LKML address; I replied to your early patch)
> 
> On Wed, Apr 15, 2015 at 12:49:23PM +0100, Wang Kai wrote:
>> In log_early function, crt_early_log should also count once when
>> 'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported
>> count from kmemleak_init is one less than 'actual number'.
>>
>> Then, in kmemleak_init, if early_log buffer size equal actual
>> number, kmemleak will init sucessful, so change warning condition
>> to 'crt_early_log > ARRAY_SIZE(early_log)'.
>>
>> Signed-off-by: Wang Kai <morgan.wang@huawei.com>
>> ---
>>  mm/kmemleak.c |    5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
>> index 5405aff..49956cf 100644
>> --- a/mm/kmemleak.c
>> +++ b/mm/kmemleak.c
>> @@ -814,6 +814,8 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
>>  	}
>>  
>>  	if (crt_early_log >= ARRAY_SIZE(early_log)) {
>> +		/* kmemleak will stop recording, just count the requests */
> 
> You could say "just count the last request" since kmemleak_disable()
> would set kmemleak_error to 1 and you never get to this block again.
> 
>> +		crt_early_log++;
>>  		kmemleak_disable();
>>  		return;
>>  	}
>> @@ -1829,7 +1831,8 @@ void __init kmemleak_init(void)
>>  	object_cache = KMEM_CACHE(kmemleak_object, SLAB_NOLEAKTRACE);
>>  	scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE);
>>  
>> -	if (crt_early_log >= ARRAY_SIZE(early_log))
>> +	/* Don't warning when crt_early_log == ARRAY_SIZE(early_log) */
> 
> s/warning/warn/
> 
> But I don't think this comment is needed, just add it to the commit log.
> 
>> +	if (crt_early_log > ARRAY_SIZE(early_log))
>>  		pr_warning("Early log buffer exceeded (%d), please increase "
>>  			   "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log);
> 
> Otherwise, my ack still stands:
> 
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
> 
> .
> 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] kmemleak: record accurate early log buffer count and report when exceeded
  2015-04-15 11:44 Wang Kai
@ 2015-04-15 15:07   ` Catalin Marinas
  0 siblings, 0 replies; 9+ messages in thread
From: Catalin Marinas @ 2015-04-15 15:07 UTC (permalink / raw)
  To: Wang Kai; +Cc: linux-mm, linux-kernel

BTW, you misspelled the LKML address (I fixed it: s/\.or/\.org/)

On Wed, Apr 15, 2015 at 12:44:52PM +0100, Wang Kai wrote:
> In log_early function, crt_early_log should also count once when
> 'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported
> count from kmemleak_init is one less than 'actual number'.
> 
> Then, in kmemleak_init, if early_log buffer size equal actual
> number, kmemleak will init sucessful, so change warning condition
> to 'crt_early_log > ARRAY_SIZE(early_log)'.
> 
> Signed-off-by: Wang Kai <morgan.wang@huawei.com>

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

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

* Re: [PATCH] kmemleak: record accurate early log buffer count and report when exceeded
@ 2015-04-15 15:07   ` Catalin Marinas
  0 siblings, 0 replies; 9+ messages in thread
From: Catalin Marinas @ 2015-04-15 15:07 UTC (permalink / raw)
  To: Wang Kai; +Cc: linux-mm, linux-kernel

BTW, you misspelled the LKML address (I fixed it: s/\.or/\.org/)

On Wed, Apr 15, 2015 at 12:44:52PM +0100, Wang Kai wrote:
> In log_early function, crt_early_log should also count once when
> 'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported
> count from kmemleak_init is one less than 'actual number'.
> 
> Then, in kmemleak_init, if early_log buffer size equal actual
> number, kmemleak will init sucessful, so change warning condition
> to 'crt_early_log > ARRAY_SIZE(early_log)'.
> 
> Signed-off-by: Wang Kai <morgan.wang@huawei.com>

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH] kmemleak: record accurate early log buffer count and report when exceeded
@ 2015-04-15 11:44 Wang Kai
  2015-04-15 15:07   ` Catalin Marinas
  0 siblings, 1 reply; 9+ messages in thread
From: Wang Kai @ 2015-04-15 11:44 UTC (permalink / raw)
  To: catalin.marinas; +Cc: linux-mm, linux-kernel

In log_early function, crt_early_log should also count once when
'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported
count from kmemleak_init is one less than 'actual number'.

Then, in kmemleak_init, if early_log buffer size equal actual
number, kmemleak will init sucessful, so change warning condition
to 'crt_early_log > ARRAY_SIZE(early_log)'.

Signed-off-by: Wang Kai <morgan.wang@huawei.com>
---
 mm/kmemleak.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 5405aff..49956cf 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -814,6 +814,8 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
 	}
 
 	if (crt_early_log >= ARRAY_SIZE(early_log)) {
+		/* kmemleak will stop recording, just count the requests */
+		crt_early_log++;
 		kmemleak_disable();
 		return;
 	}
@@ -1829,7 +1831,8 @@ void __init kmemleak_init(void)
 	object_cache = KMEM_CACHE(kmemleak_object, SLAB_NOLEAKTRACE);
 	scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE);
 
-	if (crt_early_log >= ARRAY_SIZE(early_log))
+	/* Don't warning when crt_early_log == ARRAY_SIZE(early_log) */
+	if (crt_early_log > ARRAY_SIZE(early_log))
 		pr_warning("Early log buffer exceeded (%d), please increase "
 			   "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log);
 
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2015-04-15 23:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-15 11:49 [PATCH] kmemleak: record accurate early log buffer count and report when exceeded Wang Kai
2015-04-15 11:49 ` Wang Kai
2015-04-15 15:13 ` Catalin Marinas
2015-04-15 15:13   ` Catalin Marinas
2015-04-15 23:23   ` Wang Kai
2015-04-15 23:23     ` Wang Kai
  -- strict thread matches above, loose matches on Subject: below --
2015-04-15 11:44 Wang Kai
2015-04-15 15:07 ` Catalin Marinas
2015-04-15 15:07   ` 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.