Re: PATCH: bdevname()/cdevname()/kdevname(), do_open() + misc.

Alexander Viro (viro@math.psu.edu)
Sun, 20 Dec 1998 05:07:01 -0500 (EST)


On Sat, 19 Dec 1998, Tigran Aivazian wrote:

> - error = PTR_ERR(tmp);
> - if (IS_ERR(tmp))
> + if (IS_ERR(tmp)) {
> + error = PTR_ERR(tmp);
> goto out_fail;

Please, don't. The original variant turns into

<trivial computation>
<test>
<conditional jump to out_fail>

Your variant gives

<test>
<conditional jump to l>
<trivial computation>
<jump to out_fail>
l:

The sad part being that second variant introduces a jump into the main
code path. Yes, it excludes PTR_ERR() stuff from said path, but look at
the definition of PTR_ERR and you'll see that you've increased the cost.
Pattern
error = foo;
if (bar)
goto baz_fail;
is there for purpose. Look at the compiled code and compare yourself.
Keep in mind that jumps cost a lot.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/