Skip to content

Commit

Permalink
slub: fix handling of oversized slabs
Browse files Browse the repository at this point in the history
I'm getting zillions of undefined references to __kmalloc_size_too_large on
alpha.  For some reason alpha is building out-of-line copies of kmalloc_slab()
into lots of compilation units.

It turns out that gcc just isn't smart enough to work out that
__builtin_contant_p(size)==true implies that __builtin_contant_p(index)==true.

So let's give it a bit of help.

Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed May 17, 2007
1 parent 0b44f7a commit ade3aff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/linux/slub_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ static inline struct kmem_cache *kmalloc_slab(size_t size)
if (index == 0)
return NULL;

if (index < 0) {
/*
* This function only gets expanded if __builtin_constant_p(size), so
* testing it here shouldn't be needed. But some versions of gcc need
* help.
*/
if (__builtin_constant_p(size) && index < 0) {
/*
* Generate a link failure. Would be great if we could
* do something to stop the compile here.
Expand Down

0 comments on commit ade3aff

Please sign in to comment.