From: Hao Ge <hao.ge@linux.dev>
To: Abhishek Bapat <abhishekbapat@google.com>,
Suren Baghdasaryan <surenb@google.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] alloc_tag: expose profiling and compression states in /proc/allocinfo
Date: Fri, 31 Jul 2026 10:41:52 +0800 [thread overview]
Message-ID: <0dcd8c2c-d841-47c2-997a-640d1937a77a@linux.dev> (raw)
In-Reply-To: <0d84763f140ea735d790e0b30a8e954536beb875.1785455267.git.abhishekbapat@google.com>
Hi Abhishek
Thanks for the v2 patch.
On 2026/7/31 07:48, 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.
>
> Resolve this ambiguity by exposing the active compression state by
> adding a new read-only sysctl `vm.memprofiling_compressed` to output the
> state.
I think this should be vm.mem_profiling_compressed.
Otherwise, you will need to adjust the procname for this new sysctl
accordingly.
Also, kindly add docs at the linked path.
https://elixir.bootlin.com/linux/v7.2-rc4/source/Documentation/mm/allocation-profiling.rst#L33
> Signed-off-by: Abhishek Bapat <abhishekbapat@google.com>
> ---
> mm/alloc_tag.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c
> index 52aece27b00e..877068241f06 100644
> --- a/mm/alloc_tag.c
> +++ b/mm/alloc_tag.c
> @@ -1303,6 +1303,12 @@ static const struct ctl_table memory_allocation_profiling_sysctls[] = {
> .mode = 0644,
> .proc_handler = proc_mem_profiling_handler,
> },
> + {
> + .procname = "mem_profiling_compressed",
> + .data = &mem_profiling_compressed,
> + .mode = 0444,
> + .proc_handler = proc_do_static_key,
> + },
> };
>
I think adding this sysctl alone won't be enough.
If we set boot arg sysctl.vm.mem_profiling=1,compressed but profiling
gets disabled due to insufficient page flags,
this sysctl will still report 1 (compression enabled) even though
profiling was shut down.
To verify this behavior, I have set up a test environment locally as
shown below:
[ 0.265503] 4046 allocation tags cannot be references using 5
available page flag bits. Memory allocation profiling is disabled!
[root@localhost ~]# cat /proc/sys/vm/mem_profiling_compressed
1
[root@localhost ~]#
I'm unsure whether we should initialize this sysctl when profiling gets
disabled at boot.
If we do, we should set mem_profiling_compressed to false in
shutdown_mem_profiling.
Thanks
Best Regards
Hao
> static void __init sysctl_init(void)
>
> base-commit: 2ed26e8a624f41887d64e2e37a2f6ab36a118d1f
prev parent reply other threads:[~2026-07-31 2:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 23:48 [PATCH v2] alloc_tag: expose profiling and compression states in /proc/allocinfo Abhishek Bapat
2026-07-31 2:41 ` Hao Ge [this message]
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=0dcd8c2c-d841-47c2-997a-640d1937a77a@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