From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Roel Kluin <12o3l@tiscali.nl>
Cc: dwalker@mvista.com, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] change likeliness accounting
Date: Mon, 17 Mar 2008 13:45:13 +1100 [thread overview]
Message-ID: <200803171345.14164.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <47D9B35C.9@tiscali.nl>
On Friday 14 March 2008 10:06, Roel Kluin wrote:
> In the patch below I propose some changes to the likely/unlikely
> accounting. ---
> In struct likeliness: store __builtin_return_address in 'caller', rather
> than __FILE__ and __func__, and combine 'type' and 'line' into one 'label'.
>
> The __check_likely macro performs some functionality originally in
> do_check_likely(): The first check for LP_UNSEEN bit, the increment of the
> experienced likely-count. do_check_likely() looses its parameter and return
> value. I added a __builtin_expect() to make use of the expectation.
>
> The likely diplay changes: now +/- denotes whether expectation fails in
> less than 0.01% of the tests rather than whether more unexpected than
> expected were encountered. __FILE__ is no longer displayed in output.
0.01%, so 1 time every 10 000 tests.
That seems pretty excessive. If the 9 999 tests which were taken
correctly each saved only 0.1 cycle due to the likely annotation,
then that would be implying the same likely annotation adds 1 000
cycles to the cost of the branch when taken that way.
In practice, I'd say it is probably just going to cost an extra
icache miss, another jump, and maybe a cycle here or there... 100
cycles at worst. And the benefit might also be larger than 0.1 cycle
because it could save some icache and reduce cold branch mispredicts.
It will also make the next gcc use jumps instead of cmov, which
reduces hazards to the out of order engine for example.
I think 1-5% is more reasonable a number if I were to pull one out of
my hat.
prev parent reply other threads:[~2008-03-17 2:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 23:06 Roel Kluin
2008-03-14 19:53 ` Daniel Walker
2008-03-14 20:26 ` Daniel Walker
2008-03-17 2:45 ` Nick Piggin [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=200803171345.14164.nickpiggin@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=12o3l@tiscali.nl \
--cc=dwalker@mvista.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®