Re: [2.6 patch] add an -Os config option

From: Adrian Bunk
Date: Tue Aug 12 2003 - 11:03:25 EST


On Tue, Aug 12, 2003 at 11:43:50AM -0400, Timothy Miller wrote:
>
>
> Christoph Hellwig wrote:
> >On Mon, Aug 11, 2003 at 11:11:45PM +0200, Adrian Bunk wrote:
> >
> >>The patch below adds an option OPTIMIZE_FOR_SIZE (depending on EMBEDDED)
> >>that changes the optimization from -O2 to -Os.
> >
> >
> >Please dropt the if EMBEDDED - this makes perfecty sense for lots of
> >todays hardware..
> >
> >In fact we should probably rather do some some benchmarking whether it
> >would be a good idea to make -Os the default.
>
>
> Interesting thought... In reality, we want the system to spend as
> little time in the kernel as possible. If we've done that job right,
> then optimizing for size shouldn't matter as much. We're still spending
> most of our time in user space.
>
> Furthermore, it may be that we could benefit from compiling some source
> files with -Os and others with -O2, depending on how critical they are
> and how much they are ACTUALLY affected.
>...
> Comments?

First of all, compiling my own kernel with gcc 3.3.1 resulted in less
than 10% difference in the size of the kernel image (and ACPI is not
part of my kernel) - the mere difference in size isn't that important
except for special needs (like boot _floppies_ or embedded systems
with very limited memory).

The benchmarking Christoph was referring to was to check whether a
kernel completely compiled with -Os is faster than a kernel compiled
with -O2. This might sound strange, but if the code is smaller more fits
into the cache and modern CPUs suffer much every time they need to
access the incredibly slow RAM.

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/