[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090403042131.GA15669@localhost>
Date: Fri, 3 Apr 2009 07:21:32 +0300
From: Eduard - Gabriel Munteanu <eduard.munteanu@...ux360.ro>
To: Pekka Enberg <penberg@...helsinki.fi>
Cc: Ingo Molnar <mingo@...e.hu>, Mel Gorman <mel@....ul.ie>,
Jason Baron <jbaron@...hat.com>, linux-kernel@...r.kernel.org,
mm-commits@...r.kernel.org, alexn@....su.se,
akpm@...ux-foundation.org, alexn@...ia.com, apw@...dowen.org,
cl@...ux-foundation.org, haveblue@...ibm.com,
kamezawa.hiroyu@...fujitu.com,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Steven Rostedt <rostedt@...dmis.org>,
Fr?d?ric Weisbecker <fweisbec@...il.com>
Subject: Re: + page-owner-tracking.patch added to -mm tree
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists