Subject: Re: Proposal: eliminate all macros in the kernel
To: Chris Jepeway <firstname.lastname@example.org>
From: Thor Lancelot Simon <email@example.com>
Date: 11/20/2005 14:32:43
On Sun, Nov 20, 2005 at 02:07:39PM -0500, Chris Jepeway wrote:
> I promise I'm not trying to stir anything up, but the OpenBSD
> folk visited part of this problem about a year and a half ago.
> They found that dropping inlines improved performance, as I recall.
That's going to depend strongly on architecture, and even on model
architecture within a CPU family -- it depends on function call overhead,
cache size and organization, etc. Certainly it seems intuitively obvious
that inlining anything but _very small functions_ is quite a poor idea.
One interesting thing about macros is that the optimizer gets to chew
them over in the context of each function in which they're used. I
believe that GCC gives inline functions the same treatment but I don't
know nearly enough about its guts to be sure.
I agree that we almost certainly have some macros that are so large that,
rewritten as functions, they should not be inlined. However, I think
that's a strong reason to _convert_ macros to functions: it's easy to
make a function non-inline, but not so easy to do so for a macro.