Re: [patch] measurements, numbers about CONFIG_OPTIMIZE_INLINING=y impact

Linus Torvalds
2009-01-09T17:55:49Z

On Fri, 9 Jan 2009, Matthew Wilcox wrote:
>
> That seems like valuable feedback to give to the GCC developers.

Well, one thing we should remember is that the kernel really _is_ special.

The kernel not only does things no other program tends to do (inline asms
are unusual in the first place - many of them are literally due to system
issues like atomic accesses and interrupts that simply aren't an issue in
user space, or that need so much abstraction that they aren't inlinable
anyway).

But the kernel also has totally different requirements in other ways. When
was the last time you did user space programming and needed to get a
backtrace from a user with register info because you simply don't have the
hardware that he has?

IOW, debugging in user space tends to be much more about trying to
reproduce the bug - in a way that we often cannot in the kernel. User
space in general is much more reproducible, since it's seldom as hardware-
or timing-dependent (threading does change the latter, but usually user
space threading is not _nearly_ as aggressive as the kernel has to be).

So the thing is, even if gcc was "perfect", it would likely be perfect for
a different audience than the kernel.

Do you think _any_ user space programmer worries about the stack space
being a few hundred bytes larger because the compiler inlined two
functions, and caused stack usage to be sum of them instead of just the
maximum of the two?

So we do have special issues. And exactly _because_ we have special issues
we should also expect that some compiler defaults simply won't ever really
be appropriate for us.

Linus