Re: [PATCH] bitops: simplify generic bit finding functions

Ingo Molnar
2008-04-28T21:56:37Z

* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> So we do have cases where the inlines are obviously worth it. But in
> general, I think we should try to move things from the header files
> into *.c files unless there is a really clear reason for keeping it
> that way.

there's another benefit, and in asm-x86 we prefer to move inlines to .c
files even in borderline cases because it simplifies the type
dependencies: not having to fully define all types at the function
prototype site avoids include file dependency hell.

Putting things like a task struct dereference into a lowlevel inline
file easily causes dependency problems that causes people to use macros
instead - which have their own set of readability and side-effect
problems.

a third argument is that inlines seldom get smaller. So if they are
borderline and we move them into a .c, and later on the function gets
larger, no harm is done. But if we keep the inline in a .h in the
borderline case and we grow the inline later on, the whole kernel bloats
in a multiplied way, without any apparent direct feedback to the
developer that something wrong and harmful just happened.

Ingo