Re: [patch] add /proc/pid/stack to dump task's stack trace

From: Ingo Molnar
Date: Sat Nov 08 2008 - 07:11:19 EST



* Ken Chen <kenchen@xxxxxxxxxx> wrote:

> On Fri, Nov 7, 2008 at 12:32 AM, Ingo Molnar <mingo@xxxxxxx> wrote:
> > oh well - Ken, could you please switch it to seqfiles?
>
> On Fri, Nov 7, 2008 at 12:49 AM, Alexey Dobriyan wrote:
> > Or you can do all of this in ->show(), without start/next/stop:
> >
> > for (i = 0; i < N; i++)
> > seq_printf(m, "[<%p>] %pS\n", x, x);
>
> Here is a patch convert to seq_file using proc_single_show() helper.
> I don't see it to be any superior than what was before using
> snprintf(). seq_read also allocate one page for printf buffer, so
> functionally it is the same (perhaps a little bit better because it
> can use the whole page, compare to PROC_BLOCK_SIZE currently).
> Ingo, it's your call whether to merge this patch or not.
>
> I also agree that using full blown seqfile start/show/stop won't add
> value because most valuable stack at the top are already printed.

Well, it removes 2 lines of code and makes the iteration slightly more
resilient (as there's no 'ret' value to be maintained anymore), so
i've applied your patch to tip/core/stacktrace - thanks Ken! (see the
commit below)

Sidenote: it would still be nice if the procfs folks converted the
old-style code there to the new seqfile APIs, before requiring
everyone _else_ to follow those guidelines?

Ingo

----------------->