mm: kmemleak: small cleanup
Subsystems (2)
cover mm: kmemleak: small cleanup
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(-)
Signature · 1 line
2.49.0
PATCH 1/3 mm: kmemleak: drop kmemleak_warning variable
The kmemleak_warning variable is not used since commit c5665868183f ("mm:
kmemleak: use the memory pool for early allocations"), drop it.
--- mm/kmemleak.c | 3 --- 1 file changed, 3 deletions(-)
mm/kmemleak.c +0 -3
@@ -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)/*
Signature · 1 line
2.49.0
Re: [PATCH 1/3] mm: kmemleak: drop kmemleak_warning variable
Quoted 4 lines · Luiz Capitulino
The
kmemleak_warningvariable is not used since commitc5665868183f("mm:
kmemleak: use the memory pool for early allocations"), drop it.Signed-off-by Luiz Capitulino <[email protected]>
PATCH 2/3 mm: kmemleak: drop wrong comment
In reply to Luiz CapitulinoNewly created objects have object->count == 0, so the comment is incorrect. Just drop it.
--- mm/kmemleak.c | 2 -- 1 file changed, 2 deletions(-)
mm/kmemleak.c +0 -2
@@ -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) {
Signature · 1 line
2.49.0
Re: [PATCH 2/3] mm: kmemleak: drop wrong comment
Quoted 4 lines · Luiz Capitulino
Newly created objects have
object->count== 0, so the comment is incorrect. Just drop it.Signed-off-by Luiz Capitulino <[email protected]>
PATCH 3/3 mm: kmemleak: mark variables as __read_mostly
In reply to Luiz CapitulinoThe 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.
--- mm/kmemleak.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/kmemleak.c +2 -2
@@ -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 */
Signature · 1 line
2.49.0
Re: [PATCH 3/3] mm: kmemleak: mark variables as __read_mostly
Quoted 5 lines · Luiz Capitulino
The variables
kmemleak_enabledandkmemleak_free_enabledare read in the kmemleak alloc and free path respectively, but are only written to if/when kmemleak is disabled.Signed-off-by Luiz Capitulino <[email protected]>
Quoted 5 lines · Luiz Capitulino
Hi,
This is a trivial
mm/kmemleak.ccleanup. I found these while reading through the code.
Quoted 8 lines
Luiz Capitulino (3):
mm: kmemleak: dropkmemleak_warningvariable
mm: kmemleak: drop wrong comment
mm: kmemleak: mark variables as__read_mostlymm/kmemleak.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
For the series
Thanks Luiz!
Signature · 3 lines
Cheers, David / dhildenb