From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30210 invoked by alias); 2 Oct 2009 15:14:04 -0000 Received: (qmail 30200 invoked by uid 22791); 2 Oct 2009 15:14:02 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from e28smtp01.in.ibm.com (HELO e28smtp01.in.ibm.com) (59.145.155.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Oct 2009 15:13:54 +0000 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp01.in.ibm.com (8.14.3/8.13.1) with ESMTP id n92FDmIX000389 for ; Fri, 2 Oct 2009 20:43:48 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n92FDmAS2801832 for ; Fri, 2 Oct 2009 20:43:48 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id n92FDl2h008217 for ; Sat, 3 Oct 2009 01:13:47 +1000 Received: from localhost ([9.77.193.215]) by d28av05.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id n92FDlvx008193 for ; Sat, 3 Oct 2009 01:13:47 +1000 Date: Fri, 02 Oct 2009 15:14:00 -0000 From: Rajasekhar Duddu To: systemtap@sources.redhat.com Subject: Re: [PATCH v3] Tracepoint Tapset for Memory Subsystem Message-ID: <20091002151344.GA9516@rajduddu> References: <20090919050102.GA3767@rajduddu> <4AB90BE0.4030405@redhat.com> <4AB94A1B.4090801@redhat.com> <20090924180817.GA9698@rajduddu> <4ABD3B2B.4020107@redhat.com> <20090930101156.GA3792@rajduddu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090930101156.GA3792@rajduddu> User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00009.txt.bz2 Hi, Thanks for all those who had sent their comments. I have modified the patch according to the comments passed. Signed-off-by: Rajasekhar Duddu diff -rupaN a/tapset/memory.stp b/tapset/memory.stp --- a/tapset/memory.stp 2009-09-30 06:14:29.000000000 -0400 +++ b/tapset/memory.stp 2009-10-02 11:05:10.000000000 -0400 @@ -195,3 +195,209 @@ probe vm.brk = kernel.function("do_brk") probe vm.oom_kill = kernel.function("__oom_kill_task") { task = $p } +/* Function to convert the GFP_FLAGS . */ + +function gfp_flag_str:string (gfp_flag:long) +%{ +int flags = (int)THIS->gfp_flag; +THIS->__retvalue[0] = '\0'; + +#ifdef __GFP_HIGH + if (flags & __GFP_HIGH) + strlcat (THIS->__retvalue, "GFP_HIGH",MAXSTRINGLEN); +#endif + +#ifdef __GFP_WAIT + if (flags & __GFP_WAIT) + strlcat (THIS->__retvalue, "GFP_WAIT",MAXSTRINGLEN); +#endif + +#ifdef __GFP_IO + if (flags & __GFP_IO) + strlcat (THIS->__retvalue, "|GFP_IO",MAXSTRINGLEN); +#endif + +#ifdef __GFP_FS + if (flags & __GFP_FS) + strlcat (THIS->__retvalue, "|GFP_FS",MAXSTRINGLEN); +#endif + +#ifdef __GFP_COLD + if (flags & __GFP_COLD) + strlcat (THIS->__retvalue, "|GFP_COLD",MAXSTRINGLEN); +#endif +#ifdef __GFP_NOWARN + if (flags & __GFP_NOWARN) + strlcat (THIS->__retvalue, "|GFP_NOWARN",MAXSTRINGLEN); +#endif + +#ifdef __GFP_REPEAT + if (flags & __GFP_REPEAT) + strlcat (THIS->__retvalue, "|GFP_REPEAT",MAXSTRINGLEN); +#endif + +#ifdef __GFP_NOFAIL + if (flags & __GFP_NOFAIL) + strlcat (THIS->__retvalue, "|GFP_NOFAIL",MAXSTRINGLEN); +#endif + +#ifdef __GFP_NORETRY + if (flags & __GFP_NORETRY) + strlcat (THIS->__retvalue, "|GFP_NORETRY",MAXSTRINGLEN); +#endif + +#ifdef __GFP_COMP + if (flags & __GFP_COMP) + strlcat (THIS->__retvalue, "|GFP_COMP",MAXSTRINGLEN); +#endif + +#ifdef __GFP_ZERO + if (flags & __GFP_ZERO) + strlcat (THIS->__retvalue, "|GFP_ZERO",MAXSTRINGLEN); +#endif + +#ifdef __GFP_NOMEMALLOC + if (flags & __GFP_NOMEMALLOC) + strlcat (THIS->__retvalue, "|GFP_NOMEMALLOC",MAXSTRINGLEN); +#endif + +#ifdef __GFP_HARDWALL + if (flags & __GFP_HARDWALL) + strlcat (THIS->__retvalue, "|GFP_HARDWALL",MAXSTRINGLEN); +#endif + +#ifdef __GFP_THISNODE + if (flags & __GFP_THISNODE) + strlcat (THIS->__retvalue, "|GFP_THISNODE",MAXSTRINGLEN); +#endif + +#ifdef __GFP_RECLAIMABLE + if (flags & __GFP_RECLAIMABLE) + strlcat (THIS->__retvalue, "|GFP_RECLAIMABLE",MAXSTRINGLEN); +#endif + + +#ifdef __GFP_NOTRACK + if (flags & __GFP_NOTRACK) + strlcat (THIS->__retvalue, "|GFP_NOTRACK",MAXSTRINGLEN); +#endif +%} + + +/** + * probe vm.kmalloc - Fires when kmalloc is requested. + * @call_site: Address of the caller function. + * @caller_function: Name of the caller function. + * @bytes_req: Requested Bytes + * @bytes_alloc: Allocated Bytes + * @gfp_flags: type of kmemory to allocate + * @ptr: Pointer to the kmemory allocated + */ + +probe vm.kmalloc = kernel.trace("kmalloc") { + name = "kmalloc" + call_site = $call_site + caller_function = symname(call_site) + bytes_req = $bytes_req + bytes_alloc = $bytes_alloc + gfp_flags = gfp_flag_str($gfp_flags) + ptr = $ptr +} + +/** + * probe vm.kmem_cache_alloc - Fires when \ + * kmem_cache_alloc is requested. + * @call_site: Address of the caller function. + * @caller_function: Name of the caller function. + * @bytes_req: Requested Bytes + * @bytes_alloc: Allocated Bytes + * @gfp_flags: Type of kmemory to allocate + * @ptr: Pointer to the kmemory allocated + */ +probe vm.kmem_cache_alloc = kernel.trace("kmem_cache_alloc") { + name = "kmem_cache_alloc" + call_site = $call_site + caller_function = symname(call_site) + bytes_req = $bytes_req + bytes_alloc = $bytes_alloc + gfp_flags = gfp_flag_str($gfp_flags) + ptr = $ptr +} + + +/** + * probe vm.kmalloc_node - Fires when kmalloc_node is requested. + * @call_site: Address of the caller function. + * @caller_function: Name of the caller function. + * @bytes_req: Requested Bytes + * @bytes_alloc: Allocated Bytes + * @gfp_flags: Type of kmemory to allocate + * @ptr: Pointer to the kmemory allocated + */ +probe vm.kmalloc_node = kernel.trace("kmalloc_node")? { + name = "kmalloc_node" + call_site = $call_site + caller_function = symname(call_site) + bytes_req = $bytes_req + bytes_alloc = $bytes_alloc + gfp_flags = gfp_flag_str($gfp_flags) + ptr = $ptr +} + +/** + * probe vm.kmem_cache_alloc_node - Fires when \ + * kmem_cache_alloc_node is requested. + * @call_site: Address of the caller function. + * @caller_function: Name of the caller function. + * @bytes_req: Requested Bytes + * @bytes_alloc: Allocated Bytes + * @gfp_flags: Type of kmemory to allocate + * @ptr: Pointer to the kmemory allocated + */ +probe vm.kmem_cache_alloc_node = kernel.trace("kmem_cache_alloc_node")? { + name = "kmem_cache_alloc_node" + call_site = $call_site + caller_function = symname(call_site) + bytes_req = $bytes_req + bytes_alloc = $bytes_alloc + gfp_flags =gfp_flag_str($gfp_flags) + ptr = $ptr +} + +probe __vm.kfree.kp = kernel.function("kfree") { + name = "kfree" + call_site = "0" + caller_function = "unknown" + ptr = $x +} + +probe __vm.kfree.tp = kernel.trace("kfree") { + name = "kfree" + call_site = $call_site + caller_function = symname(call_site) + ptr = $ptr +} + +/** + * probe vm.kfree - Fires when kfree is requested. + * @call_site: Address of the caller function (displayed if available) + * @caller_function - Name of the caller function (displayed if available) + * @ptr: Pointer to the kmemory allocated which is returned by kmalloc + */ +probe vm.kfree = __vm.kfree.tp !, + __vm.kfree.kp +{} + +/** + * probe vm.kmem_cache_free - Fires when \ + * kmem_cache_free is requested. + * @call_site: Address of the caller function. + * @caller_function: Name of the caller function. + * @ptr: Pointer to the kmemory allocated which is returned by kmem_cache + */ +probe vm.kmem_cache_free = kernel.trace("kmem_cache_free") { + name = "kmem_cache_free" + call_site = $call_site + caller_function = symname(call_site) + ptr = $ptr +} diff -rupaN a/testsuite/buildok/vm.tracepoints.stp b/testsuite/buildok/vm.tracepoints.stp --- a/testsuite/buildok/vm.tracepoints.stp 1969-12-31 19:00:00.000000000 -0500 +++ b/testsuite/buildok/vm.tracepoints.stp 2009-10-02 10:59:20.000000000 -0400 @@ -0,0 +1,32 @@ +#!/usr/bin/stp -up4 + +probe vm.kfree { + println (name) + printf("%-15s %-15p %-15s %-15p \n", execname(), call_site, caller_function, ptr) +} + +probe vm.kmalloc { + println (name) + printf("%-15s %-15p %-15s %-15p %-15d %-15d %-15s \n", execname(), call_site, caller_function, ptr, bytes_req, bytes_alloc, gfp_flags) +} + +probe vm.kmem_cache_alloc { + println (name) + printf("%-15s %-15p %-15s %-15p %-15d %-15d %-15s \n", execname(), call_site, caller_function, ptr, bytes_req, bytes_alloc, gfp_flags) +} +probe vm.kmalloc_node { + println (name) + printf("%-15s %-15p %-15s %-15p %-15d %-15d %-15s \n", execname(), call_site, caller_function, ptr, bytes_req, bytes_alloc, gfp_flags) +} + +probe vm.kmem_cache_alloc_node { + println (name) + printf("%-15s %-15p %-15s %-15p %-15d %-15d %-15s \n", execname(), call_site, caller_function, ptr, bytes_req, bytes_alloc, gfp_flags) +} + +probe vm.kmem_cache_free { + println (name) + printf("%-15s %-15p %-15s %-15p \n", execname(), call_site, caller_function, ptr) +} + + Thanks -- Rajasekhar Duddu (rajduddu@linux.vnet.ibm.com), Linux on System z - CSVT, IBM LTC, Bangalore.