lkml.org 
[lkml]   [2008]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] add /proc/pid/stack to dump task's stack trace

* Alexey Dobriyan <adobriyan@gmail.com> wrote:

> On Fri, Nov 07, 2008 at 08:59:25AM +0100, Ingo Molnar wrote:
> >
> > * Ingo Molnar <mingo@elte.hu> wrote:
> >
> > > > > + * buffer size used for proc read. See proc_info_read().
> > > > > + * 4K page size but our output routines use some slack for overruns
> > > > > + */
> > > > > +#define PROC_BLOCK_SIZE (3*1024)
> > >
> > > That sounds like a proper limit - the hard limit for this particular
> > > printout function is 4096-170, so we are well within the
> > > PROC_BLOCK_SIZE range.
> >
> > ok, i've added Ken's patch to tip/core/stacktrace and started testing
> > it.
> >
> > Alexey, i've added your Acked-by because you appeared to like the
> > patch - let me know if i should remove it.
>
> Of course, I don't like it!
>
> Switch to seqfiles, add entry in TID table as well.
>
> The idea is good, though.

oh well - Ken, could you please switch it to seqfiles?

It should be something like this to convert the currently sweet and
trivial function into a much more complex seqfile iterator splitup:

- the ::start method does the kmalloc of a loop state structure like
this:

{
struct stack_trace backtrace;
unsigned long entries[MAX_STACK_TRACE_DEPTH];

int iterator;
}

and saves the trace. (struct stack_trace trace can be on-stack, it's
only needed for the save_stack_trace() - and we keep the entries
after that.)

- the ::stop method does the kfree of the loop state.

- the ::show method prints a single line, based on ->entries[->iterator]

- the ::next method does ->iterator++, and returns NULL if iterator
reaches ->backtrace.nr_entries.

it will be more source code, larger kernel image, it will be more
fragile and will be harder to review, and it wont actually matter in
practice because 99.9999% of the backtraces we care about have a size
smaller than 3K. (and where they get larger clipping them to the first
3K is perfectly fine)

Ingo


\
 
 \ /
  Last update: 2008-11-07 09:35    [W:0.081 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site