All of lore.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Anton Blanchard <anton@samba.org>
Cc: Bill Schmidt <wschmidt@us.ibm.com>, Alan Modra <amodra@gmail.com>,
	linuxppc-dev@lists.ozlabs.org, Michael Gschwind <mkg@us.ibm.com>,
	paulus@samba.org, Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Subject: Re: RFC: Reducing the number of non volatile GPRs in the ppc64 kernel
Date: Tue, 11 Aug 2015 15:08:29 -0500	[thread overview]
Message-ID: <20150811200829.GC4711@gate.crashing.org> (raw)
In-Reply-To: <20150810145228.3f78c8e4@kryten>

On Mon, Aug 10, 2015 at 02:52:28PM +1000, Anton Blanchard wrote:
> Hi Bill, Segher,
> 
> > I agree with Segher.  We already know we have opportunities to do a
> > better job with shrink-wrapping (pushing this kind of useless
> > activity down past early exits), so having examples of code to look
> > at to improve this would be useful.
> 
> I'll look out for specific examples. I noticed this one today when
> analysing malloc(8). It is an instruction trace of _int_malloc().
> 
> The overall function is pretty huge, which I assume leads to gcc using
> so many non volatiles.

That is one part of it; also GCC deals out volatiles too generously.

> Perhaps in this case we should separate out the
> slow path into another function marked noinline.

Or GCC could do that, effectively at least.

> This is just an upstream glibc build, but I'll send the preprocessed
> source off list.

Thanks :-)

[snip code]

After the prologue there are 46 insns executed before the epilogue.
Many of those are conditional branches (that are not executed); it is
all fall-through until it jumps to the "tail" (the few insns before
the epilogue).  GCC knows how to duplicate a tail so that it can do
shrink-wrapping (the original tail needs to be followed by an epilogue,
the duplicated one does not want one); but it can only do it in very
simple cases (one basic block or at least no control flow), and that
is not the case here.  We need to handle more generic tails.

This seems related to (if not the same as!) <http://gcc.gnu.org/PR51982>.


Segher

  reply	other threads:[~2015-08-11 20:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05  4:03 RFC: Reducing the number of non volatile GPRs in the ppc64 kernel Anton Blanchard
2015-08-05  4:19 ` Segher Boessenkool
2015-08-07  5:55   ` Bill Schmidt
2015-08-10  4:52     ` Anton Blanchard
2015-08-11 20:08       ` Segher Boessenkool [this message]
2015-08-11 22:18         ` Segher Boessenkool
2015-08-13 21:04       ` Anton Blanchard
2015-08-14  2:01 ` Michael Ellerman

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=20150811200829.GC4711@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=amodra@gmail.com \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mkg@us.ibm.com \
    --cc=paulus@samba.org \
    --cc=wschmidt@us.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.