On 07/22/2016 06:27 PM, Tony Jones wrote: > On 07/20/2016 07:54 AM, Michal Hocko wrote: > >>> Michal, just to make sure I understand you correctly, do you mean that we >>> could infer the names of the shrinkers by looking at the names of their callbacks? >> >> Yes, %ps can then be used for the name of the shrinker structure >> (assuming it is available). > > This is fine for emitting via the ftrace /sys interface, but in order to have the data [name] get > marshalled thru to perf (for example) you need to add it to the TP_fast_assign entry. > > tony Unfortunately, %ps/%pF doesn't do much (re: Michal's comment "assuming it is available"): - TP_printk("%pF %p: nid: %d objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld", + TP_printk("%pF %p(%ps): nid: %d objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld", __entry->shrink, __entry->shr, + __entry->shr, __entry->nid, __entry->nr_objects_to_shrink, # cat trace_pipe bash-1917 [003] ...1 2925.941062: mm_shrink_slab_start: super_cache_scan+0x0/0x1a0 ffff88042bb60cc0(0xffff88042bb60cc0): nid: 0 objects to shrink 0 gfp_flags GFP_KERNEL pgs_scanned 1000 lru_pgs 1000 cache items 4 delta 7 total_scan 7 Otherwise what I was suggesting was something like this to ensure it was correctly marshaled for perf/etc: diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h @@ -16,6 +16,8 @@ #define RECLAIM_WB_SYNC 0x0004u /* Unused, all reclaim async */ #define RECLAIM_WB_ASYNC 0x0008u +#define SHRINKER_NAME_LEN (size_t)32 + #define show_reclaim_flags(flags) \ (flags) ? __print_flags(flags, "|", \ {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \ @@ -191,6 +193,7 @@ TRACE_EVENT(mm_shrink_slab_start, TP_STRUCT__entry( __field(struct shrinker *, shr) __field(void *, shrink) + __array(char, name, SHRINKER_NAME_LEN); __field(int, nid) __field(long, nr_objects_to_shrink) __field(gfp_t, gfp_flags) @@ -202,6 +205,11 @@ TRACE_EVENT(mm_shrink_slab_start, ), TP_fast_assign( + char sym[KSYM_SYMBOL_LEN]; + + sprint_symbol(sym, (unsigned long)shr); + strlcpy(__entry->name, sym, SHRINKER_NAME_LEN); + __entry->shr = shr; __entry->shrink = shr->scan_objects; __entry->nid = sc->nid; @@ -214,9 +222,10 @@ TRACE_EVENT(mm_shrink_slab_start, __entry->total_scan = total_scan; ), - TP_printk("%pF %p: nid: %d objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld", + TP_printk("%pF %p(%s): nid: %d objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld", __entry->shrink, __entry->shr, + __entry->name, __entry->nid, __entry->nr_objects_to_shrink, show_gfp_flags(__entry->gfp_flags), @@ -236,6 +245,7 @@ TRACE_EVENT(mm_shrink_slab_end, TP_STRUCT__entry( __field(struct shrinker *, shr) + __array(char, name, SHRINKER_NAME_LEN); __field(int, nid) __field(void *, shrink) __field(long, unused_scan) @@ -245,6 +255,11 @@ TRACE_EVENT(mm_shrink_slab_end, ), TP_fast_assign( + char sym[KSYM_SYMBOL_LEN]; + + sprint_symbol(sym, (unsigned long)shr); + strlcpy(__entry->name, sym, SHRINKER_NAME_LEN); + __entry->shr = shr; __entry->nid = nid; __entry->shrink = shr->scan_objects; @@ -254,9 +269,10 @@ TRACE_EVENT(mm_shrink_slab_end, __entry->total_scan = total_scan; ), - TP_printk("%pF %p: nid: %d unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d", + TP_printk("%pF %p(%pF): nid: %d unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d", __entry->shrink, __entry->shr, + __entry->shr, __entry->nid, __entry->unused_scan, __entry->new_scan, -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>