* [PATCH 0/3] mm: kmemleak: small cleanup
@ 2025-04-30 20:59 Luiz Capitulino
2025-04-30 20:59 ` [PATCH 1/3] mm: kmemleak: drop kmemleak_warning variable Luiz Capitulino
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Luiz Capitulino @ 2025-04-30 20:59 UTC (permalink / raw)
To: catalin.marinas; +Cc: lcapitulino, linux-kernel, linux-mm, david
Hi,
This is a trivial mm/kmemleak.c cleanup. I found these while reading through
the code.
Luiz Capitulino (3):
mm: kmemleak: drop kmemleak_warning variable
mm: kmemleak: drop wrong comment
mm: kmemleak: mark variables as __read_mostly
mm/kmemleak.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] mm: kmemleak: drop kmemleak_warning variable
2025-04-30 20:59 [PATCH 0/3] mm: kmemleak: small cleanup Luiz Capitulino
@ 2025-04-30 20:59 ` Luiz Capitulino
2025-05-01 10:39 ` Catalin Marinas
2025-04-30 20:59 ` [PATCH 2/3] mm: kmemleak: drop wrong comment Luiz Capitulino
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Luiz Capitulino @ 2025-04-30 20:59 UTC (permalink / raw)
To: catalin.marinas; +Cc: lcapitulino, linux-kernel, linux-mm, david
The kmemleak_warning variable is not used since commit c5665868183f ("mm:
kmemleak: use the memory pool for early allocations"), drop it.
Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
---
mm/kmemleak.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index c12cef3eeb32..e6df94c7b032 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -215,8 +215,6 @@ static int kmemleak_enabled = 1;
static int kmemleak_free_enabled = 1;
/* set in the late_initcall if there were no errors */
static int kmemleak_late_initialized;
-/* set if a kmemleak warning was issued */
-static int kmemleak_warning;
/* set if a fatal kmemleak error has occurred */
static int kmemleak_error;
@@ -254,7 +252,6 @@ static void kmemleak_disable(void);
#define kmemleak_warn(x...) do { \
pr_warn(x); \
dump_stack(); \
- kmemleak_warning = 1; \
} while (0)
/*
--
2.49.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] mm: kmemleak: drop wrong comment
2025-04-30 20:59 [PATCH 0/3] mm: kmemleak: small cleanup Luiz Capitulino
2025-04-30 20:59 ` [PATCH 1/3] mm: kmemleak: drop kmemleak_warning variable Luiz Capitulino
@ 2025-04-30 20:59 ` Luiz Capitulino
2025-05-01 10:40 ` Catalin Marinas
2025-04-30 20:59 ` [PATCH 3/3] mm: kmemleak: mark variables as __read_mostly Luiz Capitulino
2025-04-30 21:06 ` [PATCH 0/3] mm: kmemleak: small cleanup David Hildenbrand
3 siblings, 1 reply; 8+ messages in thread
From: Luiz Capitulino @ 2025-04-30 20:59 UTC (permalink / raw)
To: catalin.marinas; +Cc: lcapitulino, linux-kernel, linux-mm, david
Newly created objects have object->count == 0, so the comment is
incorrect. Just drop it.
Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
---
mm/kmemleak.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index e6df94c7b032..06baa3475252 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -322,8 +322,6 @@ static void hex_dump_object(struct seq_file *seq,
* sufficient references to it (count >= min_count)
* - black - ignore, it doesn't contain references (e.g. text section)
* (min_count == -1). No function defined for this color.
- * Newly created objects don't have any color assigned (object->count == -1)
- * before the next memory scan when they become white.
*/
static bool color_white(const struct kmemleak_object *object)
{
--
2.49.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] mm: kmemleak: mark variables as __read_mostly
2025-04-30 20:59 [PATCH 0/3] mm: kmemleak: small cleanup Luiz Capitulino
2025-04-30 20:59 ` [PATCH 1/3] mm: kmemleak: drop kmemleak_warning variable Luiz Capitulino
2025-04-30 20:59 ` [PATCH 2/3] mm: kmemleak: drop wrong comment Luiz Capitulino
@ 2025-04-30 20:59 ` Luiz Capitulino
2025-05-01 10:42 ` Catalin Marinas
2025-04-30 21:06 ` [PATCH 0/3] mm: kmemleak: small cleanup David Hildenbrand
3 siblings, 1 reply; 8+ messages in thread
From: Luiz Capitulino @ 2025-04-30 20:59 UTC (permalink / raw)
To: catalin.marinas; +Cc: lcapitulino, linux-kernel, linux-mm, david
The variables kmemleak_enabled and kmemleak_free_enabled are read in the
kmemleak alloc and free path respectively, but are only written to if/when
kmemleak is disabled.
Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
---
mm/kmemleak.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 06baa3475252..da9cee34ee1b 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -210,9 +210,9 @@ static struct kmem_cache *object_cache;
static struct kmem_cache *scan_area_cache;
/* set if tracing memory operations is enabled */
-static int kmemleak_enabled = 1;
+static int kmemleak_enabled __read_mostly = 1;
/* same as above but only for the kmemleak_free() callback */
-static int kmemleak_free_enabled = 1;
+static int kmemleak_free_enabled __read_mostly = 1;
/* set in the late_initcall if there were no errors */
static int kmemleak_late_initialized;
/* set if a fatal kmemleak error has occurred */
--
2.49.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] mm: kmemleak: small cleanup
2025-04-30 20:59 [PATCH 0/3] mm: kmemleak: small cleanup Luiz Capitulino
` (2 preceding siblings ...)
2025-04-30 20:59 ` [PATCH 3/3] mm: kmemleak: mark variables as __read_mostly Luiz Capitulino
@ 2025-04-30 21:06 ` David Hildenbrand
3 siblings, 0 replies; 8+ messages in thread
From: David Hildenbrand @ 2025-04-30 21:06 UTC (permalink / raw)
To: Luiz Capitulino, catalin.marinas; +Cc: lcapitulino, linux-kernel, linux-mm
On 30.04.25 22:59, Luiz Capitulino wrote:
> Hi,
>
> This is a trivial mm/kmemleak.c cleanup. I found these while reading through
> the code.
>
> Luiz Capitulino (3):
> mm: kmemleak: drop kmemleak_warning variable
> mm: kmemleak: drop wrong comment
> mm: kmemleak: mark variables as __read_mostly
>
> mm/kmemleak.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
For the series
Acked-by: David Hildenbrand <david@redhat.com>
Thanks Luiz!
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] mm: kmemleak: drop kmemleak_warning variable
2025-04-30 20:59 ` [PATCH 1/3] mm: kmemleak: drop kmemleak_warning variable Luiz Capitulino
@ 2025-05-01 10:39 ` Catalin Marinas
0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2025-05-01 10:39 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: lcapitulino, linux-kernel, linux-mm, david
On Wed, Apr 30, 2025 at 04:59:45PM -0400, Luiz Capitulino wrote:
> The kmemleak_warning variable is not used since commit c5665868183f ("mm:
> kmemleak: use the memory pool for early allocations"), drop it.
>
> Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] mm: kmemleak: drop wrong comment
2025-04-30 20:59 ` [PATCH 2/3] mm: kmemleak: drop wrong comment Luiz Capitulino
@ 2025-05-01 10:40 ` Catalin Marinas
0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2025-05-01 10:40 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: lcapitulino, linux-kernel, linux-mm, david
On Wed, Apr 30, 2025 at 04:59:46PM -0400, Luiz Capitulino wrote:
> Newly created objects have object->count == 0, so the comment is
> incorrect. Just drop it.
>
> Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] mm: kmemleak: mark variables as __read_mostly
2025-04-30 20:59 ` [PATCH 3/3] mm: kmemleak: mark variables as __read_mostly Luiz Capitulino
@ 2025-05-01 10:42 ` Catalin Marinas
0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2025-05-01 10:42 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: lcapitulino, linux-kernel, linux-mm, david
On Wed, Apr 30, 2025 at 04:59:47PM -0400, Luiz Capitulino wrote:
> The variables kmemleak_enabled and kmemleak_free_enabled are read in the
> kmemleak alloc and free path respectively, but are only written to if/when
> kmemleak is disabled.
>
> Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-05-01 10:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-30 20:59 [PATCH 0/3] mm: kmemleak: small cleanup Luiz Capitulino
2025-04-30 20:59 ` [PATCH 1/3] mm: kmemleak: drop kmemleak_warning variable Luiz Capitulino
2025-05-01 10:39 ` Catalin Marinas
2025-04-30 20:59 ` [PATCH 2/3] mm: kmemleak: drop wrong comment Luiz Capitulino
2025-05-01 10:40 ` Catalin Marinas
2025-04-30 20:59 ` [PATCH 3/3] mm: kmemleak: mark variables as __read_mostly Luiz Capitulino
2025-05-01 10:42 ` Catalin Marinas
2025-04-30 21:06 ` [PATCH 0/3] mm: kmemleak: small cleanup David Hildenbrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).