From: Mitchell Blank Jr <mitch@sfgoth.com>
To: "Richard B. Johnson" <linux-os@analogic.com>
Cc: Telemaque Ndizihiwe <telendiz@eircom.net>,
torvalds@osdl.org, akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Replaces two GOTO statements with one IF_ELSE statement in /fs/open.c
Date: Mon, 20 Jun 2005 13:34:45 -0700 [thread overview]
Message-ID: <20050620203445.GB84485@gaz.sfgoth.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0506201504440.5255@chaos.analogic.com>
Richard B. Johnson wrote:
> Did you check and benchmark the resulting code? The goto statements
> are never because the kernel developers didn't know how to use
> other constructs, you know.
>
> The goto statements are so that the normal path continues
> straight through the code while the exceptions take the jumps.
Yes, but I think in this case it's OK. IS_ERR() already includes an
"unlikely()" marking so gcc *should* be able to do the right thing.
The goto is probably just a remnant from before unlikely() existed.
There are a lot of them - cleaning them up is a good thing.
That said, it'd probably be good to look at the generated assembly in each
case to make sure it still looks good. That'd be a lot more useful than
trying to benchmark a tiny micro-optimizaiton in open() It's generally
nearly impossible to benchmark these sorts of things anyway since when
you're running a simple benchmark the whole function will be in Icache and
the branch predictor history so it'll run the same speed either way.
The advantage to keeping the fast-path straight through is that you consume
the minimum number of lines in the Icache and the branch will get predicted
correctly even without history (since the first-level branch prediction
heuristic is always "branches backward are taken, branches forward are not")
-Mitch
next prev parent reply other threads:[~2005-06-20 20:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-20 18:18 Telemaque Ndizihiwe
2005-06-20 18:43 ` Jeff Garzik
2005-06-20 18:54 ` Christoph Lameter
2005-06-20 19:51 ` Joel Schopp
2005-06-20 20:38 ` Andrew Morton
2005-06-21 8:57 ` Martin Waitz
2005-06-21 16:05 ` Linus Torvalds
2005-06-20 19:07 ` Richard B. Johnson
2005-06-20 20:34 ` Mitchell Blank Jr [this message]
2005-06-20 22:06 ` Bill Davidsen
[not found] <Pine.LNX.4.62.0506201834460.5008@localhost.localdomain.suse.lists.linux.kernel>
[not found] ` <42B70E62.5070704@pobox.com.suse.lists.linux.kernel>
[not found] ` <Pine.LNX.4.62.0506201154300.2245@graphe.net.suse.lists.linux.kernel>
[not found] ` <20050620133800.0dac1d97.akpm@osdl.org.suse.lists.linux.kernel>
2005-06-21 11:27 ` 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=20050620203445.GB84485@gaz.sfgoth.com \
--to=mitch@sfgoth.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
--cc=telendiz@eircom.net \
--cc=torvalds@osdl.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®