From d908e1cab102dbf329d2fb3d59b86df5c04f083f Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Fri, 3 May 2013 18:04:18 +0000 Subject: [PATCH] --- yaml --- r: 373742 b: refs/heads/master c: 8a965b3baa89ffedc73c0fbc750006c631012ced h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/mm/slab_common.c | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index 6b74acef9c88..556e1af66a2f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6286ae97d10ea2b5cd90532163797ab217bfdbdf +refs/heads/master: 8a965b3baa89ffedc73c0fbc750006c631012ced diff --git a/trunk/mm/slab_common.c b/trunk/mm/slab_common.c index c5d352e73d81..d2517b05d5bc 100644 --- a/trunk/mm/slab_common.c +++ b/trunk/mm/slab_common.c @@ -442,18 +442,24 @@ void __init create_kmalloc_caches(unsigned long flags) for (i = 128 + 8; i <= 192; i += 8) size_index[size_index_elem(i)] = 8; } - /* Caches that are not of the two-to-the-power-of size */ - if (KMALLOC_MIN_SIZE <= 32 && !kmalloc_caches[1]) - kmalloc_caches[1] = create_kmalloc_cache(NULL, 96, flags); - - if (KMALLOC_MIN_SIZE <= 64 && !kmalloc_caches[2]) - kmalloc_caches[2] = create_kmalloc_cache(NULL, 192, flags); - - for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) - if (!kmalloc_caches[i]) + for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) { + if (!kmalloc_caches[i]) { kmalloc_caches[i] = create_kmalloc_cache(NULL, 1 << i, flags); + /* + * Caches that are not of the two-to-the-power-of size. + * These have to be created immediately after the + * earlier power of two caches + */ + if (KMALLOC_MIN_SIZE <= 32 && !kmalloc_caches[1] && i == 6) + kmalloc_caches[1] = create_kmalloc_cache(NULL, 96, flags); + + if (KMALLOC_MIN_SIZE <= 64 && !kmalloc_caches[2] && i == 7) + kmalloc_caches[2] = create_kmalloc_cache(NULL, 192, flags); + } + } + /* Kmalloc array is now usable */ slab_state = UP;