Re: A patch for linux 2.1.127

Andi Kleen (ak@muc.de)
09 Nov 1998 15:56:26 +0100


In article <m0zcaVi-000393C@ocean.lucon.org>,
hjl@lucon.org (H.J. Lu) writes:
> Hi,
> Here is a patch for Linux 2.1.127. Now I am running Linux 2.1.127
> compiled with egcs 1.1.1 prerelease using -O6.

It is not a good idea to compile the kernel with -O6. -O6 includes
-finline-functions, and automatic inlining messes up a lot of fast
paths (mainly because egcs is not able to do register life splitting
yet)

e.g. this is a common idiom in the kernel:

static int __do_something(void)
{
/* do something slow that needs lots of registers */
}

static inline int do_something(void)
{
if (something needed)
__do_something();
}

In case the slow part is only seldom needed this generates very good
code because in the common path there is no function call and the calling
function has the complete register set for their own use (important on x86).
Now when you use -O6 the compiler will inline the slow path and increase the
number of variables that need to be fit into the same register significantly,
which gives much slower code. Also it has bad effects on the L1
cache. Nearly all functions where it pays to inline them are already
explicitely marked inline.

So just use -O2 instead of -O6.

-Andi

-
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/