LWN.net Logo

Linux for little systems

Linux for little systems

Posted Dec 18, 2003 2:34 UTC (Thu) by flewellyn (subscriber, #5047)
Parent article: Linux for little systems

Building the kernel with the -Os compiler option, which instructs gcc to optimize for size. This option results in a smaller kernel; interestingly, there have also been reports that -Os yields better performance on large systems as well, since the resulting executable has better cache behavior.

Actually, this makes some sense. With the wide disparity between modern CPU speeds (blazingly fast) and memory bus speeds (rather slow), anything which helps improve cache coherence is going to improve performance greatly. It may even outweigh the improvements from "speed" optimizations such as inlining, loop unrolling, etc. Some benchmarks in this area alone would be interesting.


(Log in to post comments)

Linux for little systems

Posted Dec 18, 2003 9:35 UTC (Thu) by gnb (subscriber, #5132) [Link]

>Some benchmarks in this area alone would be interesting.
Yes, provided they were for a system very like the one you cared about. The trouble
is there is no one right answer for a kernel expected to run on everything from
an ARM with 8k + 8k of L1 cache and nothing else to a Xeon that can probably
get the whole kernel into L2.

Linux for little systems

Posted Dec 18, 2003 9:49 UTC (Thu) by phip (subscriber, #1715) [Link]

Or a PA-RISC that has 1.5M + 750K L1 (D & I respectively) cache and nothing else...

Linux for little systems

Posted Dec 30, 2003 21:30 UTC (Tue) by joern_engel (guest, #4663) [Link]

Actually, cache size shouldn't matter too much, as it is de-facto zero anyway.

Unless things go horribly wrong, most CPU-time is spend in userspace, not in the kernel. Therefore, the userspace will flush out most kernel instructions from the cache before switching to kernelspace again. Therefore, the cache is always cold, when it comes to the kernel.

With a cold cache, smaller code is also faster code. Your bottle-neck is the memory-bus.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds