aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2012-09-04 19:38:33 -0400
committerPekka Enberg <penberg@kernel.org>2012-09-05 05:00:35 -0400
commit7c9adf5a5471647f392169ef19d3e81dcfa76045 (patch)
tree4e32d1875e45eafd4c4c9f2caedcf3419479c0b8 /mm/slab.c
parent686d550d222e8f83f6e709debbedf9d8ef77aec7 (diff)
mm/sl[aou]b: Move list_add() to slab_common.c
Move the code to append the new kmem_cache to the list of slab caches to the kmem_cache_create code in the shared code. This is possible now since the acquisition of the mutex was moved into kmem_cache_create(). Acked-by: David Rientjes <rientjes@google.com> Reviewed-by: Glauber Costa <glommer@parallels.com> Reviewed-by: Joonsoo Kim <js1304@gmail.com> Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 3b4587bb7b19..a69903168497 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1680,6 +1680,7 @@ void __init kmem_cache_init(void)
1680 ARCH_KMALLOC_FLAGS|SLAB_PANIC, 1680 ARCH_KMALLOC_FLAGS|SLAB_PANIC,
1681 NULL); 1681 NULL);
1682 1682
1683 list_add(&sizes[INDEX_AC].cs_cachep->list, &slab_caches);
1683 if (INDEX_AC != INDEX_L3) { 1684 if (INDEX_AC != INDEX_L3) {
1684 sizes[INDEX_L3].cs_cachep = 1685 sizes[INDEX_L3].cs_cachep =
1685 __kmem_cache_create(names[INDEX_L3].name, 1686 __kmem_cache_create(names[INDEX_L3].name,
@@ -1687,6 +1688,7 @@ void __init kmem_cache_init(void)
1687 ARCH_KMALLOC_MINALIGN, 1688 ARCH_KMALLOC_MINALIGN,
1688 ARCH_KMALLOC_FLAGS|SLAB_PANIC, 1689 ARCH_KMALLOC_FLAGS|SLAB_PANIC,
1689 NULL); 1690 NULL);
1691 list_add(&sizes[INDEX_L3].cs_cachep->list, &slab_caches);
1690 } 1692 }
1691 1693
1692 slab_early_init = 0; 1694 slab_early_init = 0;
@@ -1705,6 +1707,7 @@ void __init kmem_cache_init(void)
1705 ARCH_KMALLOC_MINALIGN, 1707 ARCH_KMALLOC_MINALIGN,
1706 ARCH_KMALLOC_FLAGS|SLAB_PANIC, 1708 ARCH_KMALLOC_FLAGS|SLAB_PANIC,
1707 NULL); 1709 NULL);
1710 list_add(&sizes->cs_cachep->list, &slab_caches);
1708 } 1711 }
1709#ifdef CONFIG_ZONE_DMA 1712#ifdef CONFIG_ZONE_DMA
1710 sizes->cs_dmacachep = __kmem_cache_create( 1713 sizes->cs_dmacachep = __kmem_cache_create(
@@ -1714,6 +1717,7 @@ void __init kmem_cache_init(void)
1714 ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA| 1717 ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA|
1715 SLAB_PANIC, 1718 SLAB_PANIC,
1716 NULL); 1719 NULL);
1720 list_add(&sizes->cs_dmacachep->list, &slab_caches);
1717#endif 1721#endif
1718 sizes++; 1722 sizes++;
1719 names++; 1723 names++;
@@ -2583,6 +2587,7 @@ __kmem_cache_create (const char *name, size_t size, size_t align,
2583 } 2587 }
2584 cachep->ctor = ctor; 2588 cachep->ctor = ctor;
2585 cachep->name = name; 2589 cachep->name = name;
2590 cachep->refcount = 1;
2586 2591
2587 if (setup_cpu_cache(cachep, gfp)) { 2592 if (setup_cpu_cache(cachep, gfp)) {
2588 __kmem_cache_destroy(cachep); 2593 __kmem_cache_destroy(cachep);
@@ -2599,8 +2604,6 @@ __kmem_cache_create (const char *name, size_t size, size_t align,
2599 slab_set_debugobj_lock_classes(cachep); 2604 slab_set_debugobj_lock_classes(cachep);
2600 } 2605 }
2601 2606
2602 /* cache setup completed, link it into the list */
2603 list_add(&cachep->list, &slab_caches);
2604 return cachep; 2607 return cachep;
2605} 2608}
2606 2609