linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Cohen <wcohen@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: "linux-perf-users@vger.kernel.org" <linux-perf-users@vger.kernel.org>
Subject: Re: Perf supporting function reordering?
Date: Mon, 17 Mar 2014 14:36:10 -0400	[thread overview]
Message-ID: <5327409A.3040309@redhat.com> (raw)
In-Reply-To: <87wqfsdbqv.fsf@tassilo.jf.intel.com>

On 03/17/2014 12:35 PM, Andi Kleen wrote:
> William Cohen <wcohen@redhat.com> writes:
> 
>> Has there been any thought about perf supporting function reordering? 
> 
> See autofdo http://gcc.gnu.org/wiki/AutoFDO and
> http://gcc.gnu.org/ml/gcc-patches/2011-09/msg01440.html
> 
> It's not in any standard compiler unfortunately.
> 
> Standard gcc can do it with profile feedback, but not for the standard kernel.

You mean GCC's "-freorder-functions"? That is rather coarse.  According to the link below it only groups functions into hot and cold sections.

http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options

> 
>> Any thoughts on making it easier for perf make this statistical
>> callgraph information available and using it to do code reordering?  I
>> have experimented with code reorder with user space postgres package
>> and it did help performance about 5% improvement in IPC
> 
> Is the mechanism of the IPC improvement understood? 

Most of the IPC performance improvement in the experiment could be explained by the reduction in the iTLB misses.

> 
> My understanding from older tools that did this the main advantage of
> pure reordering (not full profile feedback, which has many advantages) 
> is mainly in startup time improvements and lowering the TLB overhead 
> slightly, apart from slightly smaller working.

Yes, improved startup time, fewer itlb updates, and smaller working set are the expected results of function reordering.

> 
> However this all does not apply to the kernel, which does not do demand
> paging. In general modern CPUs are pretty good at prefetching code.
> 
> For the TLB issues the better strategy is likely just going for
> large pages, as Kirill's MM work enables.

For the kernel code demand paging and iTLB misses are less of an issue.  Is modules code loaded into hugepages or do they use normal sized pages?  If the modules are using normal sized pages, then wouldn't some of the large modules (for example kvm, i915 and nouveau) benefit from function reordering?

-Will

  reply	other threads:[~2014-03-17 18:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-17 16:22 Perf supporting function reordering? William Cohen
2014-03-17 16:35 ` Andi Kleen
2014-03-17 18:36   ` William Cohen [this message]
2014-03-17 23:39     ` Andi Kleen

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=5327409A.3040309@redhat.com \
    --to=wcohen@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=linux-perf-users@vger.kernel.org \
    /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).