* [PATCH] alloc_tag: move memory_allocation_profiling_sysctls into .rodata
@ 2025-12-15 15:47 Joel Granados
2025-12-23 19:35 ` Suren Baghdasaryan
0 siblings, 1 reply; 2+ messages in thread
From: Joel Granados @ 2025-12-15 15:47 UTC (permalink / raw)
To: Suren Baghdasaryan, Kent Overstreet, Andrew Morton
Cc: linux-mm, linux-kernel, 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_handler when writing is disallowed
(also controlled by mem_profiling_support).
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
lib/alloc_tag.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
index 27fee57a5c91db8067c05bff974a9e801e0ef6a0..846a5b5b44a4e5f530605c97a200e03260e73d77 100644
--- a/lib/alloc_tag.c
+++ b/lib/alloc_tag.c
@@ -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,
--
Joel Granados <joel.granados@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] alloc_tag: move memory_allocation_profiling_sysctls into .rodata
2025-12-15 15:47 [PATCH] alloc_tag: move memory_allocation_profiling_sysctls into .rodata Joel Granados
@ 2025-12-23 19:35 ` Suren Baghdasaryan
0 siblings, 0 replies; 2+ messages in thread
From: Suren Baghdasaryan @ 2025-12-23 19:35 UTC (permalink / raw)
To: Joel Granados; +Cc: Kent Overstreet, Andrew Morton, linux-mm, linux-kernel
On Mon, Dec 15, 2025 at 7:47 AM Joel Granados <joel.granados@kernel.org> wrote:
>
> 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).
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!
>
> Signed-off-by: Joel Granados <joel.granados@kernel.org>
Acked-by: Suren Baghdasaryan <surenb@google.com>
> ---
> lib/alloc_tag.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
> index 27fee57a5c91db8067c05bff974a9e801e0ef6a0..846a5b5b44a4e5f530605c97a200e03260e73d77 100644
> --- a/lib/alloc_tag.c
> +++ b/lib/alloc_tag.c
> @@ -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,
> --
> Joel Granados <joel.granados@kernel.org>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-23 19:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-15 15:47 [PATCH] alloc_tag: move memory_allocation_profiling_sysctls into .rodata Joel Granados
2025-12-23 19:35 ` Suren Baghdasaryan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox