aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/slab.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mm/slab.c b/mm/slab.c
index d66c2b0d9715..add05d808a4a 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1717,6 +1717,12 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1717 BUG(); 1717 BUG();
1718 } 1718 }
1719 1719
1720 /*
1721 * Prevent CPUs from coming and going.
1722 * lock_cpu_hotplug() nests outside cache_chain_mutex
1723 */
1724 lock_cpu_hotplug();
1725
1720 mutex_lock(&cache_chain_mutex); 1726 mutex_lock(&cache_chain_mutex);
1721 1727
1722 list_for_each(p, &cache_chain) { 1728 list_for_each(p, &cache_chain) {
@@ -1918,8 +1924,6 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1918 cachep->dtor = dtor; 1924 cachep->dtor = dtor;
1919 cachep->name = name; 1925 cachep->name = name;
1920 1926
1921 /* Don't let CPUs to come and go */
1922 lock_cpu_hotplug();
1923 1927
1924 if (g_cpucache_up == FULL) { 1928 if (g_cpucache_up == FULL) {
1925 enable_cpucache(cachep); 1929 enable_cpucache(cachep);
@@ -1978,12 +1982,12 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1978 1982
1979 /* cache setup completed, link it into the list */ 1983 /* cache setup completed, link it into the list */
1980 list_add(&cachep->next, &cache_chain); 1984 list_add(&cachep->next, &cache_chain);
1981 unlock_cpu_hotplug();
1982 oops: 1985 oops:
1983 if (!cachep && (flags & SLAB_PANIC)) 1986 if (!cachep && (flags & SLAB_PANIC))
1984 panic("kmem_cache_create(): failed to create slab `%s'\n", 1987 panic("kmem_cache_create(): failed to create slab `%s'\n",
1985 name); 1988 name);
1986 mutex_unlock(&cache_chain_mutex); 1989 mutex_unlock(&cache_chain_mutex);
1990 unlock_cpu_hotplug();
1987 return cachep; 1991 return cachep;
1988} 1992}
1989EXPORT_SYMBOL(kmem_cache_create); 1993EXPORT_SYMBOL(kmem_cache_create);