The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hao Ge <hao.ge@linux.dev>
To: Abhishek Bapat <abhishekbapat@google.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Suren Baghdasaryan <surenb@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] alloc_tag: expose profiling and compression states in /proc/allocinfo
Date: Thu, 30 Jul 2026 10:22:32 +0800	[thread overview]
Message-ID: <729c578c-e5a3-4351-b07b-469f79c26b0d@linux.dev> (raw)
In-Reply-To: <2614a3a2f5cb11b63e3cacdcc8ab20a0fe7ae972.1785365110.git.abhishekbapat@google.com>

Hi Abhishek


Thanks for your patch.


On 2026/7/30 06:49, Abhishek Bapat wrote:
> 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.


It's not obvious to me why userspace would need this state.


Suppose userspace reads mem_alloc_profiling_enabled as disabled, then 
the profiling

gets enabled later. All allocations generated during that intermediate 
window are lost.

When users later cat /proc/allocinfo and see the enabled state, will 
they mistakenly take

the output as a complete, accurate record?


I'm also unclear what userspace would do with the compression state;

this is just an internal implementation detail of memory profiling.

Put another way, personally I'd prefer /proc/allocinfo to stay lean and

avoid exposing too many internal implementation details to userspace.

Unless users intend to dig deep into how memory profiling works, these 
extra details

will likely only confuse them — most don't care about internals at all.

It's similar to how we use APIs: we only care about what an API achieves,

not its underlying implementation.


Could you share the concrete use cases for exposing these states to 
userspace?


Thanks

Best Regards

Hao


> 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

  reply	other threads:[~2026-07-30  2:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
2026-07-30 17:57   ` Abhishek Bapat
2026-07-30 19:48     ` Suren Baghdasaryan
2026-07-30 21:04       ` Abhishek Bapat
2026-07-30 21:10         ` 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=729c578c-e5a3-4351-b07b-469f79c26b0d@linux.dev \
    --to=hao.ge@linux.dev \
    --cc=abhishekbapat@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=surenb@google.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