alloc_tag: check mem_profiling_support in alloc_tag_init
Subsystems (2)
PATCH 1/1 alloc_tag: check mem_profiling_support in alloc_tag_init
If mem_profiling_support is false, for example, when sysctl.vm.mem_profiling=never, alloc_tag_init should skip allocating module tags and other operations.
Signed-off-by Casey Chen <[email protected]>
Reviewed-by Yuanyuan Zhong <[email protected]>
--- lib/alloc_tag.c | 5 +++++ 1 file changed, 5 insertions(+)
lib/alloc_tag.c +5 -0
@@ -762,6 +762,11 @@ static int __init alloc_tag_init(void) };int res; +if (!mem_profiling_support) { +pr_info ("Memory allocation profiling is not supported!\n" ); +return 0 ; + } + res =alloc_mod_tags_mem ();if (res)return res;
Signature · 1 line
2.49.0
Quoted 4 lines · Casey Chen
If
mem_profiling_supportis false, for example, when sysctl.vm.mem_profiling=never,alloc_tag_initshould skip allocating module tags and other operations.
Makes sense except we still want to have sysctl_init() call executed so that userspace is able to read the state of mem_profiling.
Quoted 26 lines
Signed-off-by Casey Chen <[email protected]>Reviewed-by Yuanyuan Zhong <[email protected]>--- lib/alloc_tag.c | 5 +++++ 1 file changed, 5 insertions(+)lib/alloc_tag.c +5
-1@@ -762,6 +762,11 @@ static int __init alloc_tag_init(void) };int res; +if (!mem_profiling_support) { +pr_info ("Memory allocation profiling is not supported!\n" ); +return 0 ; + } + res =alloc_mod_tags_mem ();if (res)return res; --2.49.0