Commit c7e43c78 authored by Alok Kataria's avatar Alok Kataria Committed by Linus Torvalds

[PATCH] Fix slab BUG_ON() triggered by change in array cache size

With the new changes that we made in the initialization of the slab
allocator, we first setup the cache from which array caches are allocated,
and then the cache, from which kmem_list3's are allocated.

Now if the array cache comes from a cache in which objsize > 32, (in this
instance size-64) then, first size-64 cache will be allocated and then the
size-128 (if this is the cache from which kmem_list3's are going to be
allocated).

So with these new changes, we are not guaranteed that we will be
initializing the malloc_sizes array in a serialized order. Thus there is
a bug in __find_general_cachep, as we are checking whether the first
cache_sizes ptr is NULL.

This is replaced by checking whether the array-cache cache is initialized.
Attached is a patch which does that.  Boots fine on a x86-64, with
DEBUG_SPIN, DEBUG_SLAB, and preempt.

Attached is a patch which does that.  Boots fine on a x86-64, with
DEBUG_SPIN, DEBUG_SLAB, and preempt.Thanks & Regards, Alok
Signed-off-by: default avatarAlok N Kataria <alokk@calsoftinc.com>
Signed-off-by: Shobhit Dayal <shobhitdayal.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Cc: Christoph Lameter <christoph@lameter.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c7fb0b35
...@@ -659,7 +659,7 @@ static inline kmem_cache_t *__find_general_cachep(size_t size, ...@@ -659,7 +659,7 @@ static inline kmem_cache_t *__find_general_cachep(size_t size,
* kmem_cache_create(), or __kmalloc(), before * kmem_cache_create(), or __kmalloc(), before
* the generic caches are initialized. * the generic caches are initialized.
*/ */
BUG_ON(csizep->cs_cachep == NULL); BUG_ON(malloc_sizes[INDEX_AC].cs_cachep == NULL);
#endif #endif
while (size > csizep->cs_size) while (size > csizep->cs_size)
csizep++; csizep++;
......
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