[ale] Optimizing the Kernel (fwd)

Chris Ricker kaboom at gatech.edu
Sat Sep 11 10:10:49 EDT 1999


Under the presumption that this was meant for ALE, I'm forwarding it.

A couple of comments about what Mike says:  the compiler situation under
Linux is currently a mess (there are too darn many of them ;-).  For some,
it's true that -O4 doesn't do much, if anything, more than -O2.  For others,
it's not.  GCC 2.95.1, for example, turns on inline-function optimization
once you do more than -O2, and that's a feature that's practically
guaranteed to break your kernel.  If you're using pgcc (and if you're
worried enough about kernel speed to want to recompile -O4 -mpentiumpro, I'd
assume you are), optimization levels are implemented up to -O6, and -O3 and
higher turn on *lots* of stuff, most of which is a Bad Idea for kernels.

Also, please keep in mind that Linus et al will ignore all kernel crash
reports from 2.2 if they can't be reproduced when compiled with gcc 2.7.2.3.
That's not quite as true of 2.3 (and presumably 2.4 when it comes out for
Christmas), but gcc 2.7 and -O2 is still the recommended way, and definitely
the way to go if you expect support from the developers.

later,
chris

-- 
Chris Ricker                                               kaboom at gatech.edu
                                              chris.ricker at genetics.utah.edu

---------- Forwarded message ----------
Date: Sat, 11 Sep 1999 00:01:38 -0400 (EDT)
 From: Mike Kachline <kachline at medept17.coon.gatech.edu>
To: Chris Ricker <kaboom at gatech.edu>
Subject: Re: [ale] Optimizing the Kernel


On Thu, 9 Sep 1999, Chris Ricker wrote:

> On Wed, 8 Sep 1999, Nomad the Wanderer wrote:
> 
> > 
> > I was reading a thread about optimizing compiling.  I re-compileed mutt
> > with -O4 and there was a nice improvement.
> > 
> > I'd like to do that with my kernel and use "-O4 -mpentiumpro" (my machine
> > is a dual-p2 300)...
<snip>

<snip> 
> Nowhere.  You will break the kernel, if you do anything more than the -02
> that it already does, in all sorts of mysterious and not-immediately-obvious
> ways.
<snip>

	I have to agree with Chris fully here. Any part of the kernel
which *could* be optimized for your specific machine probably already is
(or will be soon). As an end user, you see this show up when you specify
which processor you're compiling for (i386, i486, Pentium, PPro, etc.) in
menuconfig, xconfig, or whatever you happen to use to configure your
kernel build. Likewise, tweaks such as the "MTRR" optimization are added
if they can be (read /usr/src/linux/Documentation/mtrr.txt for more info).
	As far as going to "-O4" from "-O2", spend a night and read
through your man page of gcc to see exactly what "-O2" and "-O4" does.
You'll find that "-O2" does just about everything you'd want anyhow.


						- Mike
====================================================================
Michael Kachline CS, Georgia Institute of Technlology
kachline at brightstar.gt.ed.net
http://brightstar.gt.ed.net/kachline
====================================================================






More information about the Ale mailing list