Re: [patch] uninline init_waitqueue_*() functions

Linus Torvalds
2006-07-05T21:22:04Z

On Wed, 5 Jul 2006, Ingo Molnar wrote:
>
> i had CONFIG_DEBUG_INFO (and UNWIND_INFO) disabled in all these build
> tests.

Good, because I just verified: those two together will on their own
increase "text size" by about 17% for me.

I still think Andrew is right: I don't see how an initializer that should
basically be three instructions can possibly be 35 bytes larger than a
function call that should be a minimum of two instructions (argument setup
in %eax and the actual call - and that's totally ignoring the
deleterious effects of a function call on register liveness).

The fact that with allnoconfig the kernel is _smaller_ (but, quite
franlkly, within the noise) with the inlined version would seem to back up
Andrews position that it really shouldn't matter.

So I'm left wondering why it matters for you, and what triggers it. Maybe
there is some secondary issue that could show us an even more interesting
optimization (or some compiler behaviour that we should try to encourage).

It is, for example, entirely possible that the size reduction is REAL, but
that it comes from some other interesting source like gcc deciding to not
inline a function that isn't a leaf function - and that turning those
init_waitqueue_*() functions into real function calls thus has a secondary
effect that is the _real_ advantage.

In other words, I think the patch is fine per se, and I wouldn't mind
applying it at all, but I think it would be good to understand _what_
exactly makes for the reduction in size.

In particular, if it is some secondary effect, maybe we'd be better off
trying to aim for that secondary effect _directly_.

See?

Linus