aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slob.c
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2012-07-06 16:25:10 -0400
committerPekka Enberg <penberg@kernel.org>2012-07-09 05:13:30 -0400
commit039363f38bfe5f6281e9eae5e0518b11577d9d50 (patch)
tree11aa16feccb68b035aa9e9f390a54e57fa2ffd83 /mm/slob.c
parent068ce415bea9e2b96bde76dc1bf6e672a89903ee (diff)
mm, sl[aou]b: Extract common code for kmem_cache_create()
Kmem_cache_create() does a variety of sanity checks but those vary depending on the allocator. Use the strictest tests and put them into a slab_common file. Make the tests conditional on CONFIG_DEBUG_VM. This patch has the effect of adding sanity checks for SLUB and SLOB under CONFIG_DEBUG_VM and removes the checks in SLAB for !CONFIG_DEBUG_VM. Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slob.c')
-rw-r--r--mm/slob.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/mm/slob.c b/mm/slob.c
index 95d1c7dd88e0..d63923d549ec 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -506,7 +506,7 @@ size_t ksize(const void *block)
506} 506}
507EXPORT_SYMBOL(ksize); 507EXPORT_SYMBOL(ksize);
508 508
509struct kmem_cache *kmem_cache_create(const char *name, size_t size, 509struct kmem_cache *__kmem_cache_create(const char *name, size_t size,
510 size_t align, unsigned long flags, void (*ctor)(void *)) 510 size_t align, unsigned long flags, void (*ctor)(void *))
511{ 511{
512 struct kmem_cache *c; 512 struct kmem_cache *c;
@@ -529,13 +529,11 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
529 c->align = ARCH_SLAB_MINALIGN; 529 c->align = ARCH_SLAB_MINALIGN;
530 if (c->align < align) 530 if (c->align < align)
531 c->align = align; 531 c->align = align;
532 } else if (flags & SLAB_PANIC)
533 panic("Cannot create slab cache %s\n", name);
534 532
535 kmemleak_alloc(c, sizeof(struct kmem_cache), 1, GFP_KERNEL); 533 kmemleak_alloc(c, sizeof(struct kmem_cache), 1, GFP_KERNEL);
534 }
536 return c; 535 return c;
537} 536}
538EXPORT_SYMBOL(kmem_cache_create);
539 537
540void kmem_cache_destroy(struct kmem_cache *c) 538void kmem_cache_destroy(struct kmem_cache *c)
541{ 539{