Linux Trace Kernel
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: "Wander Lairson Costa" <wander@redhat.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David Hildenbrand" <david@redhat.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	"Richard Chang" <richardycc@google.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"open list:TRACING" <linux-kernel@vger.kernel.org>,
	"open list:TRACING" <linux-trace-kernel@vger.kernel.org>,
	"David Rientjes" <rientjes@google.com>,
	"Christoph Lameter" <cl@gentwo.org>,
	"Hyeonggon Yoo" <42.hyeyoo@gmail.com>
Subject: Re: [PATCH] kmem/tracing: Add kmem name to kmem_cache_alloc tracepoint
Date: Mon, 3 Feb 2025 09:34:29 +0100	[thread overview]
Message-ID: <46e70b3c-6d96-4507-ba17-a52e8362873d@suse.cz> (raw)
In-Reply-To: <20250130181639.58280-1-wander@redhat.com>

On 1/30/25 19:16, Wander Lairson Costa wrote:
> The kmem_cache_free tracepoint includes a "name" field, which allows
> for easy identification and filtering of specific kmem's. However, the
> kmem_cache_alloc tracepoint lacks this field, making it difficult to
> pair corresponding alloc and free events for analysis.

Hm yeah looks like the free one was added in commit 3544de8ee6e48 and their
use case didn't need alloc too, but it makes sense.

> Add the "name" field to kmem_cache_alloc to enable consistent tracking
> and correlation of kmem alloc and free events.
> 
> Signed-off-by: Wander Lairson Costa <wander@redhat.com>

I will take this in the slab tree, unless Steven objects.

Thanks,
Vlastimil

> ---
>  include/trace/events/kmem.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
> index b37eb0a7060f..8ffb022f024c 100644
> --- a/include/trace/events/kmem.h
> +++ b/include/trace/events/kmem.h
> @@ -22,6 +22,7 @@ TRACE_EVENT(kmem_cache_alloc,
>  	TP_STRUCT__entry(
>  		__field(	unsigned long,	call_site	)
>  		__field(	const void *,	ptr		)
> +		__string(	name,		s->name		)
>  		__field(	size_t,		bytes_req	)
>  		__field(	size_t,		bytes_alloc	)
>  		__field(	unsigned long,	gfp_flags	)
> @@ -32,6 +33,7 @@ TRACE_EVENT(kmem_cache_alloc,
>  	TP_fast_assign(
>  		__entry->call_site	= call_site;
>  		__entry->ptr		= ptr;
> +		__assign_str(name);
>  		__entry->bytes_req	= s->object_size;
>  		__entry->bytes_alloc	= s->size;
>  		__entry->gfp_flags	= (__force unsigned long)gfp_flags;
> @@ -41,9 +43,10 @@ TRACE_EVENT(kmem_cache_alloc,
>  					  (s->flags & SLAB_ACCOUNT)) : false;
>  	),
>  
> -	TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d accounted=%s",
> +	TP_printk("call_site=%pS ptr=%p name=%s bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d accounted=%s",
>  		(void *)__entry->call_site,
>  		__entry->ptr,
> +		__get_str(name),
>  		__entry->bytes_req,
>  		__entry->bytes_alloc,
>  		show_gfp_flags(__entry->gfp_flags),


  reply	other threads:[~2025-02-03  8:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30 18:16 [PATCH] kmem/tracing: Add kmem name to kmem_cache_alloc tracepoint Wander Lairson Costa
2025-02-03  8:34 ` Vlastimil Babka [this message]
2025-02-03 13:15   ` Steven Rostedt

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=46e70b3c-6d96-4507-ba17-a52e8362873d@suse.cz \
    --to=vbabka@suse.cz \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian.koenig@amd.com \
    --cc=cl@gentwo.org \
    --cc=david@redhat.com \
    --cc=djwong@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=richardycc@google.com \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=wander@redhat.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