Commit 07ed76b2 authored by Jack Steiner's avatar Jack Steiner Committed by Linus Torvalds

[PATCH] slab: allocate larger cache_cache if order 0 fails

kmem_cache_init() incorrectly assumes that the cache_cache object will fit
in an order 0 allocation.  On very large systems, this is not true.  Change
the code to try larger order allocations if order 0 fails.
Signed-off-by: default avatarJack Steiner <steiner@sgi.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 731805b4
...@@ -1124,6 +1124,7 @@ void __init kmem_cache_init(void) ...@@ -1124,6 +1124,7 @@ void __init kmem_cache_init(void)
struct cache_sizes *sizes; struct cache_sizes *sizes;
struct cache_names *names; struct cache_names *names;
int i; int i;
int order;
for (i = 0; i < NUM_INIT_LISTS; i++) { for (i = 0; i < NUM_INIT_LISTS; i++) {
kmem_list3_init(&initkmem_list3[i]); kmem_list3_init(&initkmem_list3[i]);
...@@ -1167,11 +1168,15 @@ void __init kmem_cache_init(void) ...@@ -1167,11 +1168,15 @@ void __init kmem_cache_init(void)
cache_cache.buffer_size = ALIGN(cache_cache.buffer_size, cache_line_size()); cache_cache.buffer_size = ALIGN(cache_cache.buffer_size, cache_line_size());
cache_estimate(0, cache_cache.buffer_size, cache_line_size(), 0, for (order = 0; order < MAX_ORDER; order++) {
&left_over, &cache_cache.num); cache_estimate(order, cache_cache.buffer_size,
cache_line_size(), 0, &left_over, &cache_cache.num);
if (cache_cache.num)
break;
}
if (!cache_cache.num) if (!cache_cache.num)
BUG(); BUG();
cache_cache.gfporder = order;
cache_cache.colour = left_over / cache_cache.colour_off; cache_cache.colour = left_over / cache_cache.colour_off;
cache_cache.slab_size = ALIGN(cache_cache.num * sizeof(kmem_bufctl_t) + cache_cache.slab_size = ALIGN(cache_cache.num * sizeof(kmem_bufctl_t) +
sizeof(struct slab), cache_line_size()); sizeof(struct slab), cache_line_size());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment