From: Hao Ge <hao.ge@linux.dev>
To: Abhishek Bapat <abhishekbapat@google.com>,
Suren Baghdasaryan <surenb@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/4] alloc_tag: Extend allocinfo_filter to support tracing queries
Date: Wed, 21 Oct 2026 15:44:40 +0800 [thread overview]
Message-ID: <98855929-df9c-4615-84ea-b90acba8c2ae@linux.dev> (raw)
In-Reply-To: <9e49a8f68e4e7d25c5a9a73c1926f68e468ef320.1792439751.git.abhishekbapat@google.com>
On 2026/10/20 04:00, Abhishek Bapat wrote:
> Extend the allocinfo filtering mechanism to allow users to filter tags
> based on their trace state.
>
> Signed-off-by: Abhishek Bapat <abhishekbapat@google.com>
> Acked-by: Suren Baghdasaryan <surenb@google.com>
Acked-by: Hao Ge <hao.ge@linux.dev>
> ---
> include/uapi/linux/alloc_tag.h | 8 ++++++--
> mm/alloc_tag.c | 8 ++++++++
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/alloc_tag.h b/include/uapi/linux/alloc_tag.h
> index dafcba2f7e2c..a96054ac2237 100644
> --- a/include/uapi/linux/alloc_tag.h
> +++ b/include/uapi/linux/alloc_tag.h
> @@ -38,7 +38,8 @@ struct allocinfo_counter {
> __u64 bytes;
> __u64 calls;
> __u8 accurate;
> - __u8 pad[7];
> + __u8 trace_on;
> + __u8 pad[6];
> } __attribute__((aligned(8)));
>
> struct allocinfo_tag_data {
> @@ -54,7 +55,8 @@ enum {
> ALLOCINFO_FILTER_INACCURATE,
> ALLOCINFO_FILTER_MIN_SIZE,
> ALLOCINFO_FILTER_MAX_SIZE,
> - __ALLOCINFO_FILTER_LAST = ALLOCINFO_FILTER_MAX_SIZE
> + ALLOCINFO_FILTER_TRACE_ON,
> + __ALLOCINFO_FILTER_LAST = ALLOCINFO_FILTER_TRACE_ON
> };
>
> #define ALLOCINFO_FILTER_MASK_MODNAME (1 << ALLOCINFO_FILTER_MODNAME)
> @@ -64,6 +66,7 @@ enum {
> #define ALLOCINFO_FILTER_MASK_INACCURATE (1 << ALLOCINFO_FILTER_INACCURATE)
> #define ALLOCINFO_FILTER_MASK_MIN_SIZE (1 << ALLOCINFO_FILTER_MIN_SIZE)
> #define ALLOCINFO_FILTER_MASK_MAX_SIZE (1 << ALLOCINFO_FILTER_MAX_SIZE)
> +#define ALLOCINFO_FILTER_MASK_TRACE_ON (1 << ALLOCINFO_FILTER_TRACE_ON)
>
> #define ALLOCINFO_FILTER_MASKS \
> ((1 << (__ALLOCINFO_FILTER_LAST + 1)) - 1)
> @@ -75,6 +78,7 @@ struct allocinfo_filter {
> __u64 max_size;
> /* filter criteria only; see allocinfo_counter.accurate for actual accuracy */
> __u64 inaccurate;
> + __u64 tracing;
> };
>
> struct allocinfo_get_at {
> diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c
> index 9ff9dd04d692..0d4d267c065f 100644
> --- a/mm/alloc_tag.c
> +++ b/mm/alloc_tag.c
> @@ -250,6 +250,7 @@ static void allocinfo_to_params(struct codetag *ct,
> data->counter.bytes = counters->bytes;
> data->counter.calls = counters->calls;
> data->counter.accurate = !alloc_tag_is_inaccurate(ct_to_alloc_tag(ct));
> + data->counter.trace_on = alloc_tag_is_traced(ct_to_alloc_tag(ct));
> }
>
> /*
> @@ -323,6 +324,13 @@ static bool matches_filter(struct codetag *ct, struct allocinfo_filter *filter,
> return false;
> }
>
> + if (filter->mask & ALLOCINFO_FILTER_MASK_TRACE_ON) {
> + bool tracing = alloc_tag_is_traced(ct_to_alloc_tag(ct));
> +
> + if (tracing != !!(filter->tracing))
I recall Suren had a small nit on this hunk in the previous version.
I don't see this change here, did I miss something?
> + return false;
> + }
> +
> return true;
> }
>
next prev parent reply other threads:[~2026-10-21 7:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 20:00 [PATCH v3 0/4] alloc_tag: Introduce selective tracing for MAP Abhishek Bapat
2026-10-19 20:00 ` [PATCH v3 1/4] alloc_tag: Add trace events for tracing allocations Abhishek Bapat
2026-10-21 7:36 ` Hao Ge
2026-10-19 20:00 ` [PATCH v3 2/4] alloc_tag: Introduce IOCTLs to toggle allocation tracepoints Abhishek Bapat
2026-10-21 7:37 ` Hao Ge
2026-10-19 20:00 ` [PATCH v3 3/4] alloc_tag: Extend allocinfo_filter to support tracing queries Abhishek Bapat
2026-10-20 20:00 ` sashiko-bot
2026-10-21 7:44 ` Hao Ge [this message]
2026-10-19 20:00 ` [PATCH v3 4/4] alloc_tag: Add a test for trace state toggle and filtering Abhishek Bapat
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=98855929-df9c-4615-84ea-b90acba8c2ae@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=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