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

From: Timothy Miller
Date: Tue Aug 12 2003 - 10:34:07 EST




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.

So... we need profiling to determine what is used and how much. And we need benchmarking to determine what is affected and by how much. Over the next couple of years, it might be good for Linus and others to adopt a policy where the default optimization for individual files is determined based on experience and need.

If only 5% of the source files are compiled with -O2, that's not going to bloat the kernel much, we'll get an optimal balance of performance and size, and everyone will be happy.

We may find it valuable to divide up the sources differently. There may be source files with both critical and noncritical functions that needed to be separated out so they can be compiled differently.

And while we're at it, if there is ever any benefit to -O3, that could be used on a per-file basis as well.

Comments?

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