提交 7243cc05 编写于 作者: I Ivan Kokshaysky 提交者: Linus Torvalds

[PATCH] slab: alpha inlining fix

It is essential that index_of() be inlined.  But alpha undoes the gcc
inlining hackery and index_of() ends up out-of-line.  So fiddle with things
to make that function inline again.

Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 4b3c86a7
...@@ -98,6 +98,9 @@ ...@@ -98,6 +98,9 @@
#undef inline #undef inline
#undef __inline__ #undef __inline__
#undef __inline #undef __inline
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 1 || __GNUC__ > 3
#undef __always_inline
#define __always_inline inline __attribute__((always_inline))
#endif
#endif /* __ALPHA_COMPILER_H */ #endif /* __ALPHA_COMPILER_H */
...@@ -308,12 +308,12 @@ struct kmem_list3 __initdata initkmem_list3[NUM_INIT_LISTS]; ...@@ -308,12 +308,12 @@ struct kmem_list3 __initdata initkmem_list3[NUM_INIT_LISTS];
#define SIZE_L3 (1 + MAX_NUMNODES) #define SIZE_L3 (1 + MAX_NUMNODES)
/* /*
* This function may be completely optimized away if * This function must be completely optimized away if
* a constant is passed to it. Mostly the same as * a constant is passed to it. Mostly the same as
* what is in linux/slab.h except it returns an * what is in linux/slab.h except it returns an
* index. * index.
*/ */
static inline int index_of(const size_t size) static __always_inline int index_of(const size_t size)
{ {
if (__builtin_constant_p(size)) { if (__builtin_constant_p(size)) {
int i = 0; int i = 0;
...@@ -329,7 +329,8 @@ static inline int index_of(const size_t size) ...@@ -329,7 +329,8 @@ static inline int index_of(const size_t size)
extern void __bad_size(void); extern void __bad_size(void);
__bad_size(); __bad_size();
} }
} } else
BUG();
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册