Subject: Re: Proposal: eliminate all macros in the kernel
To: Thor Lancelot Simon <firstname.lastname@example.org>
From: David Laight <email@example.com>
Date: 11/20/2005 20:01:26
On Sun, Nov 20, 2005 at 12:09:27PM -0500, Thor Lancelot Simon wrote:
> I propose that we replace all macros in our kernel with inline functions.
> This will clean up the mess while at the same time making it easier to
> decide whether some of this code should be inlined at all.
In many cases you really don't want inline functions either.
Inlining code can have a large negative performance due to the way
that it interacts rather badly with the instruction cache.
On most fast modern processors reading code from memory is far slower
than executing it. So if you do something twice in a function it is
probably worth arranging for it to be a loop or a called function.
Getting it inlined will slow things down (unless the calling code
itself is called again before being displaced from the cache).
Even simple things like loop unrolling may have a negative effect
due to the increase in the size of the working set.
So inlining anything that is likely to be (much) longer than the
calling sequence tends to get rather pointless.
David Laight: firstname.lastname@example.org