All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Ingo Molnar <mingo@elte.hu>, Mel Gorman <mel@csn.ul.ie>,
	Jason Baron <jbaron@redhat.com>,
	linux-kernel@vger.kernel.org, mm-commits@vger.kernel.org,
	alexn@dsv.su.se, akpm@linux-foundation.org, alexn@telia.com,
	apw@shadowen.org, cl@linux-foundation.org, haveblue@us.ibm.com,
	kamezawa.hiroyu@jp.fujitu.com,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Steven Rostedt <rostedt@goodmis.org>,
	Fr?d?ric Weisbecker <fweisbec@gmail.com>
Subject: Re: + page-owner-tracking.patch added to -mm tree
Date: Fri, 3 Apr 2009 07:21:32 +0300	[thread overview]
Message-ID: <20090403042131.GA15669@localhost> (raw)
In-Reply-To: <1238656331.26286.17.camel@penberg-laptop>

On Thu, Apr 02, 2009 at 10:12:11AM +0300, Pekka Enberg wrote:
> On Wed, 2009-04-01 at 17:22 +0200, Ingo Molnar wrote:
> > > +kmemtrace_print_page_alloc_user(struct trace_iterator *iter,
> > > +				struct kmemtrace_page_alloc_entry *entry)
> > > +{
> > > +	struct kmemtrace_user_event_page_alloc *ev_alloc;
> > > +	struct trace_seq *s = &iter->seq;
> > > +	struct kmemtrace_user_event *ev;
> > > +
> > > +	ev = trace_seq_reserve(s, sizeof(*ev));
> > > +	if (!ev)
> > > +		return TRACE_TYPE_PARTIAL_LINE;
> > > +
> > > +	ev->event_id		= KMEMTRACE_USER_PAGE_ALLOC;
> > > +	ev->type_id		= entry->type_id;
> > > +	ev->event_size		= sizeof(*ev) + sizeof(*ev_alloc);
> > > +	ev->cpu			= iter->cpu;
> > > +	ev->timestamp		= iter->ts;
> > > +	ev->call_site		= 0ULL;	/* FIXME */
> > > +	ev->ptr			= 0ULL;	/* FIXME */
> > 
> > Here we could call save_stack_trace(), in a way like this, to save 
> > up to 8 entries of the allocation back-trace:
> 
> The example code compiled as-is so here's an updated patch! :-) We
> should probably do stack traces for _all_ events like you suggested but
> that's a bigger ABI change so I did it only for the new page allocation
> event.

I've thought about exporting a stack trace instead of a call-site
pointer, sounds nice. But I figure we should leave ev->call_site filled
as before, it's useful in some cases to show who is the intended caller,
e.g. caller-tracking variants of kmalloc.

It could also work out-of-the-box with the existing kmemtrace, since we
consume and ignore the remaining ev->event_size bytes we don't know how to
interpret. Moreover, events can hold 2^16 bytes which is enough to
export more than 8 previous frames.

One thing I'm not sure about this patch is whether it manages to record
an allocation only once, i.e. does it log a single event when/if the slab
allocator requests pages? Some time ago I sent a patch adding GFP_NOTRACE
to gfp.h, but was rejected. Maybe this could be a way out of the mess.

(GFP_NOTRACE would also allow us to log "backend" allocations easily and
treat them separately, for the record, or simply filter them out.)


	Cheers,
	Eduard


  reply	other threads:[~2009-04-03  4:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31 23:21 + page-owner-tracking.patch added to -mm tree akpm
2009-04-01 11:15 ` Ingo Molnar
2009-04-01 12:55   ` Mel Gorman
2009-04-01 13:17     ` Ingo Molnar
2009-04-01 13:32       ` Mel Gorman
2009-04-01 13:49         ` Ingo Molnar
2009-04-01 14:49           ` Pekka Enberg
2009-04-01 15:22             ` Ingo Molnar
2009-04-02  7:12               ` Pekka Enberg
2009-04-03  4:21                 ` Eduard - Gabriel Munteanu [this message]
2009-04-03 14:17                   ` Ingo Molnar
2009-04-03 14:36                     ` Pekka Enberg
2009-04-03 14:43                       ` Ingo Molnar
2009-04-04 14:08                         ` Eduard - Gabriel Munteanu
2009-04-06  7:12                         ` Pekka Enberg

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=20090403042131.GA15669@localhost \
    --to=eduard.munteanu@linux360.ro \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=alexn@dsv.su.se \
    --cc=alexn@telia.com \
    --cc=apw@shadowen.org \
    --cc=cl@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=haveblue@us.ibm.com \
    --cc=jbaron@redhat.com \
    --cc=kamezawa.hiroyu@jp.fujitu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mel@csn.ul.ie \
    --cc=mingo@elte.hu \
    --cc=mm-commits@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.