From: Petr Mladek <pmladek@suse.com>
To: Joe Perches <joe@perches.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Yue Haibing <yuehaibing@huawei.com>,
sergey.senozhatsky@gmail.com, andriy.shevchenko@linux.intel.com,
geert+renesas@glider.be, me@tobin.cc,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH -next] lib/vsprintf: Make function pointer_string static
Date: Tue, 30 Apr 2019 10:42:31 +0200 [thread overview]
Message-ID: <20190430084231.y5fm5zvjdcwyzt7t@pathway.suse.cz> (raw)
In-Reply-To: <3078981761ff2a37354221eb79a1c24e43c30896.camel@perches.com>
On Mon 2019-04-29 09:42:30, Joe Perches wrote:
> On Mon, 2019-04-29 at 10:39 -0400, Steven Rostedt wrote:
> > [ added Joe ]
> > > Good question. I have just double checked it. And pointer_string() with
> > > "noinline_for_stack" does not make any difference in the stack
> > > usage here.
> > >
> > > I actually played with this before:
> > >
> > > "noinline_for_stack" is a black magic added by
> > > the commit cf3b429b03e827c7180 ("vsprintf.c: use noinline_for_stack").
> >
> > From what I understand, "noinline_for_stack" is just noinline and the
> > "for_stack" part is just to document that the noinline is used for
> > stack purposes. If the compiler doesn't inline the function without the
> > noinline, then it wont make any difference.
> >
> > The point was to not inline the function because it can be used in
> > stack critical areas, and that it's better to do the call than to
> > increase the stack.
>
> It was added because of %pV is recursive and recursive
> functions can eat
> a lot of stack.
>
> Using noinline_for_stack was just a bit more self-documenting.
>
> I do still think it's a useful notation.
I understand the problem and noinline_for_stack improved some
paths definitely.
On the other hand, the call instruction uses the stack as well.
Note that many of the annotated functions have 5 parameters.
I believe that some of the annotated functions might get inlined
with a lower stack usage in the caller than what is needed
by the call.
The problem is that it depends on the used compiler, optimization,
and architecture. I personally do not want to invest much time
into optimizing this unless people report real life problems.
Best Regards,
Petr
prev parent reply other threads:[~2019-04-30 8:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 16:46 [PATCH -next] lib/vsprintf: Make function pointer_string static Yue Haibing
2019-04-26 17:02 ` Steven Rostedt
2019-04-29 11:08 ` Petr Mladek
2019-04-29 13:13 ` Steven Rostedt
2019-04-29 14:30 ` Petr Mladek
2019-04-29 14:39 ` Steven Rostedt
2019-04-29 16:42 ` Joe Perches
2019-04-30 8:42 ` Petr Mladek [this message]
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=20190430084231.y5fm5zvjdcwyzt7t@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=geert+renesas@glider.be \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=me@tobin.cc \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=yuehaibing@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).