]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: kmemleak: mark variables as __read_mostly
authorLuiz Capitulino <luizcap@redhat.com>
Wed, 30 Apr 2025 20:59:47 +0000 (16:59 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 13 May 2025 06:50:47 +0000 (23:50 -0700)
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.

Link: https://lkml.kernel.org/r/4016090e857e8c4c2ade4b20df312f7f38325c15.1746046744.git.luizcap@redhat.com
Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/kmemleak.c

index 06baa347525240b33c98e0e5af6cb2e56e0473ca..da9cee34ee1b8de87a78fa2b05439758a6537f95 100644 (file)
@@ -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 */