mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hao Ge <hao.ge@linux.dev>
To: Abhishek Bapat <abhishekbapat@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-trace-kernel@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 0/4] alloc_tag: Introduce selective tracing for MAP
Date: Thu, 24 Sep 2026 17:53:25 +0800	[thread overview]
Message-ID: <057359f7-0e8f-416b-8b5e-0b60c1c936e9@linux.dev> (raw)
In-Reply-To: <cover.1790025465.git.abhishekbapat@google.com>

Hi Abhishek

Thanks for your patch.

On 2026/9/22 05:26, Abhishek Bapat wrote:
> The existing memory allocation profiling (MAP) tool accurately maintains
> aggregate counters for overall memory accounting. However, relying
> purely on aggregated counters restrics the visibility needed for
> targeted debugging.
> 
> This patch series integrates three new tracepoints (alloc_tag_hit,
> alloc_tag_mem_alloced and alloc_tag_mem_freed) directly into the
> alloc_hooks_tag fast path.
> 
> Enabling trace events globally for all allocations introduces a severe
> baseline overhead. To limit the performance overhead, we let the admin
> select specific allocations to be traced.
> 
> A new IOCTL is introduced to allow privileged users to determine which
> allocation tags need tracing enabled. The IOCTL utilizes the
> pre-existing filtering mechanism to specify the allocation tags to
> enable tracing on.
>

I think this cover‑letter could go into more detail.
Also, the cover‑letter doesn't include any how‑to‑use.

Looking over this series, it seems you expect users to first call
ALLOCINFO_IOC_GET_AT to obtain a tag, then pass that tag into
ALLOCINFO_IOC_TOGGLE_TRACE.

This behaviour is not reflected in the existing cover‑letter.
Before reading the code, I assumed I could just pass a module
name to trace all allocations from that module. After going
through the implementation, that turns out not to be the case.

Because patch 2 enforces a full mask requirement for the filter.

struct allocinfo_filter filter = {
	.mask = ALLOCINFO_FILTER_MASK_MODNAME |
		ALLOCINFO_FILTER_MASK_FUNCTION |
		ALLOCINFO_FILTER_MASK_FILENAME |
		ALLOCINFO_FILTER_MASK_LINENO,
	.fields = params.fields,
};

So to trace all allocations from an entire module, users have to combine
ALLOCINFO_IOC_GET_AT, ALLOCINFO_IOC_GET_NEXT and ALLOCINFO_IOC_TOGGLE_TRACE
together.

I have no strong objections if this is the intended design.
That said, we should settle on the expected usage model up‑front.

Having corresponding Documentation would also be quite helpful. That way when others
ask how to work with this feature, we can point them to existing written material.

https://elixir.bootlin.com/linux/v7.3-rc3/source/Documentation/mm/allocation-profiling.rst

Thanks
Best Regards
Hao

> Abhishek Bapat (4):
>   alloc_tag: Add trace events for tracing allocations
>   alloc_tag: Introduce IOCTLs to toggle allocation tracepoints
>   alloc_tag: extend allocinfo_filter to support tracing queries
>   alloc_tag: add a test for trace state toggle and filtering
> 
>  MAINTAINERS                                   |   1 +
>  include/linux/alloc_tag.h                     |  94 +++++++++---
>  include/linux/codetag.h                       |   5 +-
>  include/trace/events/alloc_tag.h              | 122 +++++++++++++++
>  include/uapi/linux/alloc_tag.h                |  17 ++-
>  mm/alloc_tag.c                                | 142 +++++++++++++++++-
>  .../alloc_tag/allocinfo_ioctl_test.c          | 111 +++++++++++++-
>  7 files changed, 462 insertions(+), 30 deletions(-)
>  create mode 100644 include/trace/events/alloc_tag.h
> 
> 
> base-commit: 8d61431ed2607386b427752505379536eb634ce8

      parent reply	other threads:[~2026-09-24  9:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 21:26 Abhishek Bapat
2026-09-21 21:26 ` [PATCH 1/4] alloc_tag: Add trace events for tracing allocations Abhishek Bapat
2026-09-23  9:56   ` Hao Ge
2026-09-23 20:12     ` Abhishek Bapat
2026-09-24  1:22       ` Hao Ge
2026-09-24  7:22   ` Hao Ge
2026-09-21 21:26 ` [PATCH 2/4] alloc_tag: Introduce IOCTLs to toggle allocation tracepoints Abhishek Bapat
2026-09-24  8:17   ` Hao Ge
2026-09-21 21:26 ` [PATCH 3/4] alloc_tag: extend allocinfo_filter to support tracing queries Abhishek Bapat
2026-09-21 21:26 ` [PATCH 4/4] alloc_tag: add a test for trace state toggle and filtering Abhishek Bapat
2026-09-24  9:53 ` 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=057359f7-0e8f-416b-8b5e-0b60c1c936e9@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=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.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

all inboxes | Powered by JetHome®