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

From: Linus Torvalds
Date: Mon Apr 28 2008 - 15:39:09 EST




On Mon, 28 Apr 2008, Thomas Gleixner wrote:
>
> I doubt that that is worth the trouble and we should just remove those
> inlines alltogether. This was discussed before, but Andi objected to
> remove those micro optimizations and nobody had time to actually
> verify the real benefits.

Thanks for checking.

In general, I think we should act the other way: we should *assume* that
inlines and complex macros in header files are not worth it and we'd be
better off with just plain function calls, unless it's really obvious that
the inline function is always worth it.

We have tons of good examples of inline functions in headers that really
*really* want to be that way: <linux/list.h> is generally a collection of
things that clearly expand to somthing that is (a) easily critical and (b)
inlining things generally really causes a smaller code footprint than
having a "call" instruction and all the argument setup - regardless of how
many times it is done.

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.

(Some inline functions do depend on things like constant arguments goign
away, with kmalloc() being a good example of some really nasty header file
tricks that are likely worth it despite their extreme ugliness)

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/