![](https://seccdn.libravatar.org/avatar/1b513b121143c05e1aad2e55ce52e0d2.jpg?s=120&d=mm&r=g)
I have read in linuxJournal that I can be able to optimize my kernel using this parameters: CFLAGS='-o9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions' I have some problems 1. My cpu is a Atlon at 900 mhz, not a pentium. With what to replace pentiumpro ? 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 ?
![](https://seccdn.libravatar.org/avatar/8ce4efecf1119dcbfc03135ad33fee46.jpg?s=120&d=mm&r=g)
Dorin Titiriga wrote:
I have read in linuxJournal that I can be able to optimize my kernel using this parameters:
CFLAGS='-o9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions'
I have some problems
1. My cpu is a Atlon at 900 mhz, not a pentium. With what to replace pentiumpro ? 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 ?
Some of these flags look distinctly dangerous. The -o9 should be -O9 and is pretty well guaranteed to cause problems (I have found that even -O3 can cause problems with very simple code I've written). The -malign-double flag will speed things up a fraction but at the risk of creating incompatibilities. For example, I once tried compiling gimp with this flag and found that it crashed when using jpeg files. The -mcpu=pentiumpro and -march=pentiumpro mean generate code optimised for a pentium pro and generate code that will only run on pentium pro or higher (and therefore even more optimised). I don't think there's any advantage in using both and they may even conflict. For an Athlon, the flag you want is -march=k6. If you configure your own kernel with xconfig (and probably menuconfig too), you get the option of specifying what kind of architecture you have and the configuration automatically gives you sensible optimisations. It is unwise to try to do more unless you really know what you are doing. JDL
![](https://seccdn.libravatar.org/avatar/015241a395c8b9b4902a1adae206330b.jpg?s=120&d=mm&r=g)
On Tuesday 12 March 2002 02:45 am, John Lamb wrote:
The -mcpu=pentiumpro and -march=pentiumpro mean generate code optimised for a pentium pro and generate code that will only run on pentium pro or higher (and therefore even more optimised). I don't think there's any advantage in using both and they may even conflict. For an Athlon, the flag you want is -march=k6.
Actually, the Athlon is a "K7" device, which likes optimizations more akin to a Pentium 3 than to a k6 CPU.
If you configure your own kernel with xconfig (and probably menuconfig too), you get the option of specifying what kind of architecture you have and the configuration automatically gives you sensible optimisations. It is unwise to try to do more unless you really know what you are doing.
Agreed 100%. -- Psychiatrists say that one out of four people are mentally ill. Check three friends. If they're OK, you're it.
![](https://seccdn.libravatar.org/avatar/7be15f4c71a45bbaa6a40011640179d6.jpg?s=120&d=mm&r=g)
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
participants (4)
-
Dorin Titiriga
-
John Lamb
-
Joshua Lee
-
Philipp Thomas