diff options
author | Andrey Konovalov <andrey.konovalov@linaro.org> | 2015-04-14 17:42:42 +0300 |
---|---|---|
committer | Andrey Konovalov <andrey.konovalov@linaro.org> | 2015-04-14 17:42:42 +0300 |
commit | 29dfbd875f09ec67d28033da496c7e4613fabbc9 (patch) | |
tree | 986ad6ebb66a95d60a78f3398fbefff3c8a8de59 /mm | |
parent | 5b05a7bfb614b57ead12010b92429946ca12e5bb (diff) | |
parent | 230b22d72454f0b9ed2cf1410771bbba7830f89e (diff) |
Automatically merging tracking-llvm into merge-linux-linaro
Conflicting files:
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 1 | ||||
-rw-r--r-- | mm/slab.h | 1 | ||||
-rw-r--r-- | mm/slab_common.c | 37 | ||||
-rw-r--r-- | mm/slub.c | 1 |
4 files changed, 24 insertions, 16 deletions
diff --git a/mm/slab.c b/mm/slab.c index c4b89eaf4c96..cc690383b82b 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1440,6 +1440,7 @@ void __init kmem_cache_init(void) kmalloc_caches[INDEX_NODE] = create_kmalloc_cache("kmalloc-node", kmalloc_size(INDEX_NODE), ARCH_KMALLOC_FLAGS); slab_state = PARTIAL_NODE; + correct_kmalloc_cache_index_table(); slab_early_init = 0; diff --git a/mm/slab.h b/mm/slab.h index 4c3ac12dd644..82f8a8008d2b 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -71,6 +71,7 @@ unsigned long calculate_alignment(unsigned long flags, #ifndef CONFIG_SLOB /* Kmalloc array related functions */ +void correct_kmalloc_cache_index_table(void); void create_kmalloc_caches(unsigned long); /* Find the kmalloc slab corresponding for a certain size */ diff --git a/mm/slab_common.c b/mm/slab_common.c index 999bb3424d44..2bba2c62338d 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -784,25 +784,19 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags) } /* - * Create the kmalloc array. Some of the regular kmalloc arrays - * may already have been created because they were needed to - * enable allocations for slab creation. + * Patch up the size_index table if we have strange large alignment + * requirements for the kmalloc array. This is only the case for + * MIPS it seems. The standard arches will not generate any code here. + * + * Largest permitted alignment is 256 bytes due to the way we + * handle the index determination for the smaller caches. + * + * Make sure that nothing crazy happens if someone starts tinkering + * around with ARCH_KMALLOC_MINALIGN */ -void __init create_kmalloc_caches(unsigned long flags) -{ +void __init correct_kmalloc_cache_index_table(void) { int i; - /* - * Patch up the size_index table if we have strange large alignment - * requirements for the kmalloc array. This is only the case for - * MIPS it seems. The standard arches will not generate any code here. - * - * Largest permitted alignment is 256 bytes due to the way we - * handle the index determination for the smaller caches. - * - * Make sure that nothing crazy happens if someone starts tinkering - * around with ARCH_KMALLOC_MINALIGN - */ BUILD_BUG_ON(KMALLOC_MIN_SIZE > 256 || (KMALLOC_MIN_SIZE & (KMALLOC_MIN_SIZE - 1))); @@ -833,6 +827,17 @@ void __init create_kmalloc_caches(unsigned long flags) for (i = 128 + 8; i <= 192; i += 8) size_index[size_index_elem(i)] = 8; } +} + +/* + * Create the kmalloc array. Some of the regular kmalloc arrays + * may already have been created because they were needed to + * enable allocations for slab creation. + */ +void __init create_kmalloc_caches(unsigned long flags) +{ + int i; + for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) { if (!kmalloc_caches[i]) { kmalloc_caches[i] = create_kmalloc_cache(NULL, diff --git a/mm/slub.c b/mm/slub.c index 82c473780c91..f5ef69ee0745 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3702,6 +3702,7 @@ void __init kmem_cache_init(void) kmem_cache_node = bootstrap(&boot_kmem_cache_node); /* Now we can use the kmem_cache to allocate kmalloc slabs */ + correct_kmalloc_cache_index_table(); create_kmalloc_caches(0); #ifdef CONFIG_SMP |