Mailinglist Archive: opensuse (3644 mails)

< Previous Next >
Re: [SLE] kernel optimization
  • From: Philipp Thomas <pthomas@xxxxxxx>
  • Date: Thu, 14 Mar 2002 02:33:34 +0100
  • Message-id: <e2uv8ucqmoheltdv6v37aakipp0n648ulg@xxxxxxx>
On 12 Mar 2002 07:42:11 +0200, you wrote:

-O9

Isn't *any* use! The maximum optimisation level for gcc is -O3 and the only
difference between -O2 and -O3 is automatic inlining and trust me, that this
will make the kernel code *worse* not better. The kernel is carefully tuned to
use explicit inlining where necessary.

-funroll-loops

Could give some optimisation but not much.

-ffast-math

Doesn't buy you anything, as the kernel doesn't use floating point arithmetic,
in fact FP arithmetic is stricly forbidden for the kernel.

-malign-double

Same reason, see above.

-mcpu=pentiumpro -march=pentiumpro

-mcpu= is redundant in this case as -march sets it.

-fomit-frame-pointer -fno-exceptions'

Have a look at /usr/src/linux/Makefile and you'll see that
-fomit-frame-pointer is used by default. And for C code -fno-exceptions is the
default gcc uses.


For a 2.4.X kernel, just select Athlon as processor type when configuring the
kernel and /usr/src/linux/arch/i386/Makefile will choose the correct flags.


1. My cpu is a Atlon at 900 mhz, not a pentium. With what to replace
pentiumpro ?

Which compiler? For gcc 2.95.X use '-march=i686 -malign-functions=4', for gcc
3.X just use -march=athlon. But these are choosen automically for kernel 2.4.X
and upward.

2. I have compiled at home the kernel ignoring -mcpu and -march, the
kernel was compiled fine, with no errors, but after i have installed, it
does nothing. It is broken !, so how to optimize my kernel ?

Just don't! Believe me, the defaults for 2.4.X are good enough and hand tuning
won't buy you much if at all.

At the very least, read the compiler documentation ('info gcc') and try to
understand what those options do and do not blindly follow instructions in a
magazine, specially when you're dealing with the kernel.

Philipp


< Previous Next >
References