Re: -O2 vs -O3

From: Thomas Pornin (Thomas.Pornin@ens.fr)
Date: Thu May 25 2000 - 06:46:24 EST


In article <20000524152141.A25884@thepuffingroup.com> you write:
> -O3 introduces some optimisations which may not be appropriate for the
> kernel. In particular, it tries to know better about function-inlining.
> It is asserted (note I don't necessarily agree with the assertion :-)
> that the kernel developers in their infinite wisdom have analysed which
> functions would best be inlined and which are best out-of-line.

Just for completeness: there are a couple of functions that must not
be inlined (for instance, __delay() that is in arch/i386/lib/delay.c);
but the main reason seems to be the following: the compiler uses some
heuristics to guess whether a function is worth inlining, or not. These
heuristics are tuned for userland code, not kernel code, where the
situation is different (for instance, memory is much more expensive in
the kernel, since kernel memory cannot be swapped out).

Moreover, some experiments showed that, indeed, using -O3 (or -O9)
instead of -O2 did not give a faster kernel. Reality rulez.

        --Thomas Pornin

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



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:14 EST