linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] alloc_tag: check mem_profiling_support in alloc_tag_init
@ 2025-05-07 19:14 Casey Chen
  2025-05-08 23:11 ` Suren Baghdasaryan
  0 siblings, 1 reply; 2+ messages in thread
From: Casey Chen @ 2025-05-07 19:14 UTC (permalink / raw)
  To: linux-mm; +Cc: surenb, kent.overstreet, yzhong, Casey Chen

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 <cachen@purestorage.com>
Reviewed-by: Yuanyuan Zhong <yzhong@purestorage.com>
---
 lib/alloc_tag.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
index 25ecc1334b67..232082085a95 100644
--- a/lib/alloc_tag.c
+++ b/lib/alloc_tag.c
@@ -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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] alloc_tag: check mem_profiling_support in alloc_tag_init
  2025-05-07 19:14 [PATCH] alloc_tag: check mem_profiling_support in alloc_tag_init Casey Chen
@ 2025-05-08 23:11 ` Suren Baghdasaryan
  0 siblings, 0 replies; 2+ messages in thread
From: Suren Baghdasaryan @ 2025-05-08 23:11 UTC (permalink / raw)
  To: Casey Chen; +Cc: linux-mm, kent.overstreet, yzhong

On Wed, May 7, 2025 at 12:14 PM Casey Chen <cachen@purestorage.com> wrote:
>
> 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.

Makes sense except we still want to have sysctl_init() call executed
so that userspace is able to read the state of mem_profiling.

>
> Signed-off-by: Casey Chen <cachen@purestorage.com>
> Reviewed-by: Yuanyuan Zhong <yzhong@purestorage.com>
> ---
>  lib/alloc_tag.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
> index 25ecc1334b67..232082085a95 100644
> --- a/lib/alloc_tag.c
> +++ b/lib/alloc_tag.c
> @@ -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
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-08 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-07 19:14 [PATCH] alloc_tag: check mem_profiling_support in alloc_tag_init Casey Chen
2025-05-08 23:11 ` Suren Baghdasaryan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox