mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Josef Bacik <jbacik@fb.com>
Cc: <linux-kernel@vger.kernel.org>, <kernel-team@fb.com>
Subject: Re: [PATCH] trace-cmd: add a kernel memory leak detector
Date: Wed, 24 Jun 2015 22:43:54 -0400	[thread overview]
Message-ID: <20150624224354.4dafb594@grimm.local.home> (raw)
In-Reply-To: <1435100799-32723-1-git-send-email-jbacik@fb.com>

On Tue, 23 Jun 2015 16:06:39 -0700
Josef Bacik <jbacik@fb.com> wrote:

> I needed to track down a very slow memory leak so I adapted the same approach
> trace-cmd profile uses to track kernel memory allocations.  You run this with
> 
> trace-cmd kmemleak

Note, I'm still playing with this.

> 
> and then you can kill -SIGUSR2 <trace-cmd pid> to get current status updates, or
> just stop the process when you are ready.  It will tell you how much was lost
> and the size of the objects that were allocated, along with the tracebacks and
> the counts of the allocators.  Thanks,
> 
> Signed-off-by: Josef Bacik <jbacik@fb.com>


> diff --git a/trace-kmemleak.c b/trace-kmemleak.c
> new file mode 100644
> index 0000000..2e288fe
> --- /dev/null
> +++ b/trace-kmemleak.c

Please add a copyright notice here. You can add your name as author but
more importantly, please state what license this is under. See
trace-record.c for details.

> @@ -0,0 +1,552 @@
> +#define _LARGEFILE64_SOURCE
> +#include <sys/types.h>
> +#include <unistd.h>
> +#include <stdio.h>
> +#include <getopt.h>
> +#include <signal.h>
> +
> +#include "trace-local.h"
> +#include "trace-hash.h"
> +#include "list.h"
> +
> +#define memory_from_item(item)	container_of(item, struct memory, hash)
> +#define memory_from_phash(item)	container_of(item, struct memory, phash)
> +#define leak_from_item(item)	container_of(item, struct memory_leak, hash)
> +#define edata_from_item(item)	container_of(item, struct event_data, hash)
> +#define stack_from_item(item)	container_of(item, struct stack_trace, hash)
> +



> --- a/trace-record.c
> +++ b/trace-record.c

> @@ -3703,6 +3721,7 @@ static void add_hook(struct buffer_instance *instance, const char *arg)
>  }
>  
>  enum {
> +	OPT_kmemleak	= 249,
>  	OPT_bycomm	= 250,

Ug, I realized I never applied your bycomm patch.

I'll need to look at that now too. Egad, I've been putting off
trace-cmd for to long. I need to start getting back to it!

-- Steve

>  	OPT_stderr	= 251,
>  	OPT_profile	= 252,
> @@ -3738,7 +3757,7 @@ void trace_record (int argc, char **argv)


  parent reply	other threads:[~2015-06-25  2:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-23 23:06 Josef Bacik
2015-06-24 14:17 ` Steven Rostedt
2015-06-25  2:43 ` Steven Rostedt [this message]
2015-06-25 16:44 ` [PATCH V2] " Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150624224354.4dafb594@grimm.local.home \
    --to=rostedt@goodmis.org \
    --cc=jbacik@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®