Why is kernel optimized for size?

Sean seanlkml at sympatico.ca
Tue Jan 4 02:22:38 UTC 2005


On Mon, January 3, 2005 8:34 pm, Steve Snyder said:
> I notice that the Fedora kernels have the optimize-for-size option
> enabled.  Why is this?
>
> The Fedora developers seem not to expect their kernels to be run on
> low-memory systems, given that the 4GB memory map is also enabled.
>
> Is there some benefit that -Os confers over -O2 beyond the sligh savings
> in system memory use?

There have been benchmarks run that show the supposed benefits of -O2 such
as loop unrolling end up costing too much in terms of cpu cache misses.  
Using -Os often means that many loops will execute completely out of cache
with no expensive trips to the L2 cache or even more costly trips to RAM,
thus will run faster than their -O2  equivalent.   Not to mention that
branch prediction and other facilities in modern CPU's have improved to
where some of the techniques employed under -O2 are no longer huge wins.  
That's (at least part) of the theory anyway.

Sean





More information about the fedora-list mailing list