Re: [PATCH] proc: faster /proc/*/status

From: Joe Perches
Date: Sun Aug 07 2016 - 13:39:48 EST


On Sun, 2016-08-07 at 09:59 -0700, Andi Kleen wrote:
> > And then what? Parsing format string is still be there.
> Perhaps could have a fast path for simple cases.
> >
> > This is first line of profile of the first function (format_decode)
> >
> > ÂÂÂÂÂÂÂâÂÂÂÂÂstatic noinline_for_stack
> > ÂÂÂÂÂÂÂâÂÂÂÂÂint format_decode(const char *fmt, struct printf_spec *spec)
> > ÂÂÂÂÂÂÂâÂÂÂÂÂ{
> > Â10.38 âÂÂÂÂÂÂÂpushÂÂÂ%rbp <===
> >  1.07 âÂÂÂÂÂÂÂmovÂÂÂÂ%rsp,%rbp
> >  1.09 âÂÂÂÂÂÂÂpushÂÂÂ%r12
> >  4.51 âÂÂÂÂÂÂÂmovÂÂÂÂ%rsi,%r12
> >  1.40 âÂÂÂÂÂÂÂpushÂÂÂ%rbx
> >  1.86 âÂÂÂÂÂÂÂmovÂÂÂÂ%rdi,%rbx
> > ÂÂÂÂÂÂÂâÂÂÂÂÂÂÂsubÂÂÂÂ$0x8,%rsp
> >
> > It is so bloated that gcc needs to be asked to not screw up with stack
> > size.
> What happens when you drop all the noinlines for this? I assume
> this would alread make it faster. And now that we have bigger
> stacks we can likely tolerate it.

%pV recurses through these code paths.
I believe the maximum current recursion depth is 3.