The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] alloc_tag: expose profiling and compression states in /proc/allocinfo
@ 2026-07-29 22:49 Abhishek Bapat
  2026-07-30  2:22 ` Hao Ge
  0 siblings, 1 reply; 2+ messages in thread
From: Abhishek Bapat @ 2026-07-29 22:49 UTC (permalink / raw)
  To: Suren Baghdasaryan, Andrew Morton, Hao Ge
  Cc: linux-kernel, linux-mm, Abhishek Bapat

Currently, userspace has limited visibility into the exact active
runtime state of memory allocation profiling and its page extension
compression ('sysctl.vm.mem_profiling={0|1|never}[,compressed]').

While reading the sysctl provides basic on/off status, it is currently
impossible for userspace to natively determine whether page-tag
compression was successfully enabled without scraping dmesg boot logs.
Furthermore, since /proc/allocinfo remains in the procfs filesystem even
after profiling is dynamically disabled at runtime, simply checking for
the file's presence does not reliably indicate if the allocation
tracking hooks are actively running.

Resolve this ambiguity by appending the active state directly into the
header of /proc/allocinfo.

Signed-off-by: Abhishek Bapat <abhishekbapat@google.com>
---
 mm/alloc_tag.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c
index 52aece27b00e..89ec2c6ce57a 100644
--- a/mm/alloc_tag.c
+++ b/mm/alloc_tag.c
@@ -108,7 +108,11 @@ static void allocinfo_stop(struct seq_file *m, void *arg)
 static void print_allocinfo_header(struct seq_buf *buf)
 {
 	/* Output format version, so we can change it. */
-	seq_buf_printf(buf, "allocinfo - version: 2.0\n");
+	seq_buf_printf(buf, "allocinfo - version: 2.1\n");
+	seq_buf_printf(buf, "# Profiling: %s\n",
+		       mem_alloc_profiling_enabled() ? "Enabled" : "Disabled");
+	seq_buf_printf(buf, "# Compression: %s\n",
+		       static_key_enabled(&mem_profiling_compressed) ? "Enabled" : "Disabled");
 	seq_buf_printf(buf, "#     <size>  <calls> <tag info>\n");
 }
 

base-commit: c73b725a57f276a3702ca213bde78fca029bc619
-- 
2.55.0.508.g3f0d502094-goog


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

end of thread, other threads:[~2026-07-30  2:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 22:49 [PATCH] alloc_tag: expose profiling and compression states in /proc/allocinfo Abhishek Bapat
2026-07-30  2:22 ` Hao Ge

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