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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Monday, April 28, 2008 - 12:37 pm

On Mon, 28 Apr 2008, Thomas Gleixner wrote:

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
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] bitops: simplify generic bit finding functions, Harvey Harrison, (Sun Apr 27, 1:19 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Sun Apr 27, 1:26 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Harvey Harrison, (Sun Apr 27, 1:29 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Harvey Harrison, (Sun Apr 27, 1:38 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Sun Apr 27, 1:38 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Thomas Gleixner, (Mon Apr 28, 7:04 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Alexander van Heukelum, (Mon Apr 28, 7:32 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Alexander van Heukelum, (Mon Apr 28, 7:58 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Alexander van Heukelum, (Mon Apr 28, 8:10 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Thomas Gleixner, (Mon Apr 28, 8:58 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Mon Apr 28, 9:25 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Thomas Gleixner, (Mon Apr 28, 9:47 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Mon Apr 28, 9:54 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Thomas Gleixner, (Mon Apr 28, 12:26 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Mon Apr 28, 12:37 pm)
[PATCH] bitops: remove &quot;optimizations&quot;, Thomas Gleixner, (Tue Apr 29, 3:01 am)
Re: [PATCH] bitops: remove &quot;optimizations&quot;, David Miller, (Tue Apr 29, 3:03 am)
Re: [PATCH] bitops: remove &quot;optimizations&quot;, David Miller, (Tue Apr 29, 5:34 am)
Re: [PATCH] bitops: remove &quot;optimizations&quot;, Ingo Molnar, (Tue Apr 29, 7:20 am)
Re: [PATCH] bitops: remove &quot;optimizations&quot;, Thomas Gleixner, (Tue Apr 29, 9:51 am)
Re: [PATCH] bitops: remove &quot;optimizations&quot;, David Miller, (Tue Apr 29, 3:31 pm)
Re: [PATCH] bitops: remove &quot;optimizations&quot;, David Miller, (Tue Apr 29, 3:58 pm)
Re: [PATCH] bitops: remove &quot;optimizations&quot;, David Miller, (Tue Apr 29, 4:30 pm)