|
@@ -2228,55 +2228,10 @@ __kmem_cache_create (const char *name, size_t size, size_t align,
|
|
unsigned long flags, void (*ctor)(void *))
|
|
unsigned long flags, void (*ctor)(void *))
|
|
{
|
|
{
|
|
size_t left_over, slab_size, ralign;
|
|
size_t left_over, slab_size, ralign;
|
|
- struct kmem_cache *cachep = NULL, *pc;
|
|
|
|
|
|
+ struct kmem_cache *cachep = NULL;
|
|
gfp_t gfp;
|
|
gfp_t gfp;
|
|
|
|
|
|
- /*
|
|
|
|
- * Sanity checks... these are all serious usage bugs.
|
|
|
|
- */
|
|
|
|
- if (!name || in_interrupt() || (size < BYTES_PER_WORD) ||
|
|
|
|
- size > KMALLOC_MAX_SIZE) {
|
|
|
|
- printk(KERN_ERR "%s: Early error in slab %s\n", __func__,
|
|
|
|
- name);
|
|
|
|
- BUG();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * We use cache_chain_mutex to ensure a consistent view of
|
|
|
|
- * cpu_online_mask as well. Please see cpuup_callback
|
|
|
|
- */
|
|
|
|
- if (slab_is_available()) {
|
|
|
|
- get_online_cpus();
|
|
|
|
- mutex_lock(&slab_mutex);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- list_for_each_entry(pc, &slab_caches, list) {
|
|
|
|
- char tmp;
|
|
|
|
- int res;
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * This happens when the module gets unloaded and doesn't
|
|
|
|
- * destroy its slab cache and no-one else reuses the vmalloc
|
|
|
|
- * area of the module. Print a warning.
|
|
|
|
- */
|
|
|
|
- res = probe_kernel_address(pc->name, tmp);
|
|
|
|
- if (res) {
|
|
|
|
- printk(KERN_ERR
|
|
|
|
- "SLAB: cache with size %d has lost its name\n",
|
|
|
|
- pc->size);
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!strcmp(pc->name, name)) {
|
|
|
|
- printk(KERN_ERR
|
|
|
|
- "kmem_cache_create: duplicate cache %s\n", name);
|
|
|
|
- dump_stack();
|
|
|
|
- goto oops;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
#if DEBUG
|
|
#if DEBUG
|
|
- WARN_ON(strchr(name, ' ')); /* It confuses parsers */
|
|
|
|
#if FORCED_DEBUG
|
|
#if FORCED_DEBUG
|
|
/*
|
|
/*
|
|
* Enable redzoning and last user accounting, except for caches with
|
|
* Enable redzoning and last user accounting, except for caches with
|
|
@@ -2495,11 +2450,6 @@ __kmem_cache_create (const char *name, size_t size, size_t align,
|
|
|
|
|
|
/* cache setup completed, link it into the list */
|
|
/* cache setup completed, link it into the list */
|
|
list_add(&cachep->list, &slab_caches);
|
|
list_add(&cachep->list, &slab_caches);
|
|
-oops:
|
|
|
|
- if (slab_is_available()) {
|
|
|
|
- mutex_unlock(&slab_mutex);
|
|
|
|
- put_online_cpus();
|
|
|
|
- }
|
|
|
|
return cachep;
|
|
return cachep;
|
|
}
|
|
}
|
|
|
|
|