public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: David Chinner <dgc@sgi.com>
Cc: Eric Sandeen <sandeen@sandeen.net>, Timothy Shimmin <tes@sgi.com>,
	Andi Kleen <andi@firstfloor.org>, Niv Sardi <xaiki@cxhome.ath.cx>,
	Christoph Hellwig <hch@lst.de>,
	xfs@oss.sgi.com
Subject: Re: likely and unlikely was: Re: [PATCH] split xfs_ioc_xattr
Date: Mon, 21 Apr 2008 09:55:58 +0200	[thread overview]
Message-ID: <20080421075558.GC14446@one.firstfloor.org> (raw)
In-Reply-To: <20080421003343.GL108924158@sgi.com>

On Mon, Apr 21, 2008 at 10:33:43AM +1000, David Chinner wrote:
> On Fri, Apr 18, 2008 at 09:05:25AM -0500, Eric Sandeen wrote:
> > ISTR that the dir2 code on Irix had tons of compiler pragmas for likely
> > and unlikely paths, and that it actually was well-profiled and tested.
> > Did that ever get translated into Linux hints?
> 
> The Irix code (#pragma mips_frequency_hint [FREQUENT|NEVER|INIT])
> only controllered physical placement of code, it never issued
> branch hints. 

likely/unlikely control placement too and I think it is actually
more important for kernel code than branch hints (which x86 doesn't
have explictely unlike ia64, they only way to do a branch hint is to reorder
the code) due to icache effects.

i.e. a "never" block gets moved out of line,
> while a "frequent" block is left inline. Realistically, the way
> this is used in the Irix dir2 code is completely useless - code like
> this:

Indeed because gcc has a heuristic that early returns are considered
unlikely:

/* Branch causing function to terminate is probably not taken.  */
DEF_PREDICTOR (PRED_TREE_EARLY_RETURN, "early return (on trees)", HITRATE (61), 
0)

It's only 61%, but that should be enough.

I'm somewhat surprised that MipsPro didn't have such a default heuristic 
though ...

-Andi

  reply	other threads:[~2008-04-21  7:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 20:40 [PATCH] split xfs_ioc_xattr Christoph Hellwig
2008-04-14  3:14 ` Niv Sardi
2008-04-14  3:29   ` Christoph Hellwig
2008-04-16  3:47     ` Niv Sardi
2008-04-16  6:37       ` David Chinner
2008-04-16  7:06         ` Timothy Shimmin
2008-04-16  7:29           ` Andi Kleen
2008-04-18  7:06             ` likely and unlikely was: " Timothy Shimmin
2008-04-18 13:34               ` Andi Kleen
2008-04-18 14:05               ` Eric Sandeen
2008-04-21  0:33                 ` David Chinner
2008-04-21  7:55                   ` Andi Kleen [this message]
2008-04-21 21:41                     ` David Chinner

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=20080421075558.GC14446@one.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=dgc@sgi.com \
    --cc=hch@lst.de \
    --cc=sandeen@sandeen.net \
    --cc=tes@sgi.com \
    --cc=xaiki@cxhome.ath.cx \
    --cc=xfs@oss.sgi.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