linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Casey Chen <cachen@purestorage.com>
To: linux-mm@kvack.org
Cc: surenb@google.com, kent.overstreet@linux.dev,
	yzhong@purestorage.com, Casey Chen <cachen@purestorage.com>
Subject: [PATCH] alloc_tag: check mem_profiling_support in alloc_tag_init
Date: Wed,  7 May 2025 13:14:23 -0600	[thread overview]
Message-ID: <20250507191423.45795-1-cachen@purestorage.com> (raw)

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



             reply	other threads:[~2025-05-07 19:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 19:14 Casey Chen [this message]
2025-05-08 23:11 ` Suren Baghdasaryan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250507191423.45795-1-cachen@purestorage.com \
    --to=cachen@purestorage.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=surenb@google.com \
    --cc=yzhong@purestorage.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox