alloc_tag: move memory_allocation_profiling_sysctls into .rodata
Subsystems (2)
PATCH 1/1 alloc_tag: move memory_allocation_profiling_sysctls into .rodata
Remove the change in file mode permissions done before initializing the sysctl. It is not necessary as the writing of the kernel variable will be blocked by the proc_mem_profiling_handler when writing is disallowed (also controlled by mem_profiling_support).
--- lib/alloc_tag.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
lib/alloc_tag.c +1 -4
@@ -783,7 +783,7 @@ static int proc_mem_profiling_handler(const struct ctl_table *table, int write, } -static struct ctl_table memory_allocation_profiling_sysctls[] = { +static const struct ctl_table memory_allocation_profiling_sysctls[] = { { .procname ="mem_profiling" , .data = &mem_alloc_profiling_key,
@@ -798,9 +798,6 @@ static struct ctl_table memory_allocation_profiling_sysctls[] = {static void __init sysctl_init (void ) { -if (!mem_profiling_support) - memory_allocation_profiling_sysctls[0 ].mode =0444 ; -register_sysctl_init ("vm" , memory_allocation_profiling_sysctls); }#else /* CONFIG_SYSCTL */
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251215-jag-alloc_tag_const-dc9d7c3f7a8f
Best regards,
Signature · 1 line
Joel Granados <[email protected]>
Quoted 5 lines · Joel Granados
Remove the change in file mode permissions done before initializing the sysctl. It is not necessary as the writing of the kernel variable will be blocked by the
proc_mem_profiling_handlerwhen writing is disallowed (also controlled bymem_profiling_support).
Right. When this code was written, memory_allocation_profiling_sysctls.proc_handler was using proc_do_static_key(), so this mode update was needed. But now that we use proc_mem_profiling_handler(), it can be indeed removed. Thanks for the cleanup!
Quoted 2 lines
Signed-off-by Joel Granados <[email protected]>
Quoted 37 lines
--- lib/alloc_tag.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)lib/alloc_tag.c +1
-5@@ -783,7 +783,7 @@ static int proc_mem_profiling_handler(const struct ctl_table *table, int write, } -static struct ctl_table memory_allocation_profiling_sysctls[] = { +static const struct ctl_table memory_allocation_profiling_sysctls[] = { { .procname ="mem_profiling" , .data = &mem_alloc_profiling_key,@@ -798,9 +798,6 @@ static struct ctl_table memory_allocation_profiling_sysctls[] = {static void __init sysctl_init (void ) { -if (!mem_profiling_support) - memory_allocation_profiling_sysctls[0 ].mode =0444 ; -register_sysctl_init ("vm" , memory_allocation_profiling_sysctls); }#else /* CONFIG_SYSCTL */ ---base-commit:
8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251215-jag-alloc_tag_const-dc9d7c3f7a8fBest regards,
--
Joel Granados <[email protected]>