From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754036Ab3KWJGx (ORCPT ); Sat, 23 Nov 2013 04:06:53 -0500 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.225]:5830 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750773Ab3KWJGs convert rfc822-to-8bit (ORCPT ); Sat, 23 Nov 2013 04:06:48 -0500 Date: Sat, 23 Nov 2013 04:06:45 -0500 From: Steven Rostedt To: Namhyung Kim Cc: Jiri Olsa , linux-kernel@vger.kernel.org, Corey Ashford , Frederic Weisbecker , Ingo Molnar , Paul Mackerras , Peter Zijlstra , Arnaldo Carvalho de Melo , David Ahern Subject: Re: [PATCH 06/22] tools lib traceevent: Add kmem plugin Message-ID: <20131123040645.63819a5f@gandalf.local.home> In-Reply-To: <1385131097.1747.43.camel@leonhard> References: <1385031680-9014-1-git-send-email-jolsa@redhat.com> <1385031680-9014-7-git-send-email-jolsa@redhat.com> <1385131097.1747.43.camel@leonhard> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.20; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-RR-Connecting-IP: 107.14.168.118:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Nov 2013 23:38:17 +0900 Namhyung Kim wrote: > 2013-11-21 (목), 12:01 +0100, Jiri Olsa: > > Backporting kmem plugin. > > > > Backported from Steven Rostedt's trace-cmd repo (HEAD 0f2c2fb): > > git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git > > > > This plugin adds call_site field resolving for following > > tracepoint events: > > kmem:kfree > > kmem:kmalloc > > kmem:kmalloc_node > > kmem:kmem_cache_alloc > > kmem:kmem_cache_alloc_node > > kmem:kmem_cache_free > > > > The diff of 'perf script' output generated by old and new code: > > (data was generated by 'perf record -e 'kmem:*' -a') > > > > --- script.kmem.old > > +++ script.kmem.new > > - perf 27846 [001] 29643.403319: kmem:kfree: call_site=ffffffff810e64f6 ptr=(nil) > > + perf 27846 [001] 29643.403238: kmem:kfree: (__audit_syscall_exit+0x1f6) call_site=ffffffff810e64f6 ptr=(nil) > > - perf 27846 [001] 29643.403337: kmem:kmem_cache_alloc: call_site=ffffffff812ff0c5 ptr=0xffff88020e155630 bytes_req=560 bytes_alloc=568 gfp_flags=GFP_KERNEL > > + perf 27846 [001] 29643.403337: kmem:kmem_cache_alloc: (radix_tree_preload+0x35) call_site=ffffffff812ff0c5 ptr=0xffff88020e155630 bytes_req=560 bytes_alloc=568 gfp_flags=GFP_KERNEL > > - perf 27846 [001] 29643.403342: kmem:kmem_cache_free: call_site=ffffffff8126ec61 ptr=0xffff88020dffe750 > > + perf 27846 [001] 29643.403342: kmem:kmem_cache_free: (jbd2_journal_stop+0x221) call_site=ffffffff8126ec61 ptr=0xffff88020dffe750 > > - firefox 954 [000] 29643.445477: kmem:kmem_cache_alloc_node: call_site=ffffffff8153c64e ptr=0xffff8801cecb4000 bytes_req=256 bytes_alloc=256 gfp_flags=GFP_KERNEL|GFP_REPEAT node=-1 > > + firefox 954 [000] 29643.445477: kmem:kmem_cache_alloc_node: (__alloc_skb+0x4e) call_site=ffffffff8153c64e ptr=0xffff8801cecb4000 bytes_req=256 bytes_alloc=256 gfp_flags=GFP_KERNEL|GFP_REPEAT node=-1 > > - perf 27846 [001] 29643.445510: kmem:kmalloc: call_site=ffffffff81250642 ptr=0xffff88020fd6c300 bytes_req=96 bytes_alloc=96 gfp_flags=GFP_NOFS|GFP_ZERO > > + perf 27846 [001] 29643.445510: kmem:kmalloc: (ext4_ext_find_extent+0x362) call_site=ffffffff81250642 ptr=0xffff88020fd6c300 bytes_req=96 bytes_alloc=96 gfp_flags=GFP_NOFS|GFP_ZERO > > - X 888 [002] 29643.445546: kmem:kmalloc_node: call_site=ffffffff8153c67e ptr=0xffff880103828e00 bytes_req=384 bytes_alloc=512 gfp_flags=GFP_KERNEL|GFP_NOWARN|GFP_REPEAT|GFP_NOMEMALLOC node=-1 > > + X 888 [002] 29643.445546: kmem:kmalloc_node: (__alloc_skb+0x7e) call_site=ffffffff8153c67e ptr=0xffff880103828e00 bytes_req=384 bytes_alloc=512 gfp_flags=GFP_KERNEL|GFP_NOWARN|GFP_REPEAT|GFP_NOMEMALLOC node=-1 > > It'd be great if the "call_site" in the output changes to display > function names instead of hex addresses directly. > Actually, that's what's in the (). kmem:kmalloc_node: (__alloc_skb+0x7e) call_site=ffffffff8153c67e This uses a short cut, where we don't overwrite the entire handler, in case the TP_printk() gets new fields. If the registered handler for an event, like "call_site_handler" (see how we use it for all of tracepoints) returns >0, that tells the library that we only added extra information, and to print the tracepoint as it is normally. The better solution here is to use "%pS" or something in the actual tracepoint instead. -- Steve