On Mon, Dec 02, 2019 at 04:56:01PM -0500, Steven Rostedt wrote: > On Mon, 2 Dec 2019 16:13:45 -0500 > Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> wrote: > > > On Mon, Dec 02, 2019 at 12:14:15PM -0500, Steven Rostedt wrote: > > > On Sat, 30 Nov 2019 17:50:30 -0800 > > > akpm@xxxxxxxxxxxxxxxxxxxx wrote: > > > > > > > /* Optimized variant when page is already known not to be PageAnon */ > > > > --- a/include/trace/events/kmem.h~mm-emit-tracepoint-when-rss-changes > > > > +++ a/include/trace/events/kmem.h > > > > @@ -316,6 +316,27 @@ TRACE_EVENT(mm_page_alloc_extfrag, > > > > __entry->change_ownership) > > > > ); > > > > > > > > +TRACE_EVENT(rss_stat, > > > > + > > > > + TP_PROTO(int member, > > > > + long count), > > > > + > > > > + TP_ARGS(member, count), > > > > + > > > > + TP_STRUCT__entry( > > > > + __field(int, member) > > > > + __field(long, size) > > > > + ), > > > > + > > > > + TP_fast_assign( > > > > + __entry->member = member; > > > > + __entry->size = (count << PAGE_SHIFT); > > > > > > It's best to put all calculations (including shifts) in the print part, > > > as that's the slow path. The TP_fast_assign() is done when the trace > > > point is triggered (during the execution of the code). It's best to > > > keep this in the slow path (TP_printk). > > > > > > __entry->count = count; > > > > > > > + ), > > > > + > > > > + TP_printk("member=%d size=%ldB", > > > > + __entry->member, > > > > + __entry->size) > > > > > > __entry->count << PAGE_SHIFT) > > > > Ah. Android users now use a tool called perfetto which gather raw trace > > (binary format). So such shifting will have to be done by userspace then if > > we did it this way. And I'm afraid this patch has been in circulation for > > quite some time now that may cause major pains in changing userspace tooling > > now :-\ > > > > I've been trying to get libtraceevent into a standard library, and > it's been ready to go. Can your tool please use that. It can handle this > without issue. Just feed it the format file (that's exported to > user space via the tracefs file system). I would love for that to happen but I don't develop Perfetto much. If I am writing a tool I will definitely give it a go from my side. CC'ing Perfetto's lead developer Primiano -- I believe you have already met Primiano at a conference before as he mentioned it to me that you guys met. I also believe this topic of using a common library was discussed before, but something about licensing came up. thanks, - Joel