History

kmem/tracing: add kmem name to kmem_cache_alloc tracepoint

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. Add the "name" field to kmem_cache_alloc to enable consistent tracking and correlation of kmem alloc and free events.

Wander Lairson Costa committed 1 year ago

Commit dfd04ad1 parent 46afff41 file · +4 −1Browse files

Showing the changes to include/trace (1 of 1 file). Show all

Unified · Split

include/trace/events/kmem.h+4−1
@@ -22,6 +22,7 @@ TRACE_EVENT(kmem_cache_alloc, · 21 unmodified lines
22 TP_STRUCT__entry(22 TP_STRUCT__entry(
23 __field( unsigned long, call_site )23 __field( unsigned long, call_site )
24 __field( const void *, ptr )24 __field( const void *, ptr )
25 __string( name, s->name )
25 __field( size_t, bytes_req )26 __field( size_t, bytes_req )
26 __field( size_t, bytes_alloc )27 __field( size_t, bytes_alloc )
27 __field( unsigned long, gfp_flags )28 __field( unsigned long, gfp_flags )
@@ -32,6 +33,7 @@ TRACE_EVENT(kmem_cache_alloc, · 4 unmodified lines
32 TP_fast_assign(33 TP_fast_assign(
33 __entry->call_site = call_site;34 __entry->call_site = call_site;
34 __entry->ptr = ptr;35 __entry->ptr = ptr;
36 __assign_str(name);
35 __entry->bytes_req = s->object_size;37 __entry->bytes_req = s->object_size;
36 __entry->bytes_alloc = s->size;38 __entry->bytes_alloc = s->size;
37 __entry->gfp_flags = (__force unsigned long)gfp_flags;39 __entry->gfp_flags = (__force unsigned long)gfp_flags;
@@ -41,9 +43,10 @@ TRACE_EVENT(kmem_cache_alloc, · 3 unmodified lines
41 (s->flags & SLAB_ACCOUNT)) : false;43 (s->flags & SLAB_ACCOUNT)) : false;
42 ),44 ),
43 45
44 TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d accounted=%s",46 TP_printk("call_site=%pS ptr=%p name=%s bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d accounted=%s",
45 (void *)__entry->call_site,47 (void *)__entry->call_site,
46 __entry->ptr,48 __entry->ptr,
49 __get_str(name),
47 __entry->bytes_req,50 __entry->bytes_req,
48 __entry->bytes_alloc,51 __entry->bytes_alloc,
49 show_gfp_flags(__entry->gfp_flags),52 show_gfp_flags(__entry->gfp_flags),