diff options
author | Christoph Lameter <cl@linux.com> | 2012-07-06 16:25:10 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-07-09 05:13:30 -0400 |
commit | 039363f38bfe5f6281e9eae5e0518b11577d9d50 (patch) | |
tree | 11aa16feccb68b035aa9e9f390a54e57fa2ffd83 /mm/slob.c | |
parent | 068ce415bea9e2b96bde76dc1bf6e672a89903ee (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.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -506,7 +506,7 @@ size_t ksize(const void *block) | |||
506 | } | 506 | } |
507 | EXPORT_SYMBOL(ksize); | 507 | EXPORT_SYMBOL(ksize); |
508 | 508 | ||
509 | struct kmem_cache *kmem_cache_create(const char *name, size_t size, | 509 | struct 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 | } |
538 | EXPORT_SYMBOL(kmem_cache_create); | ||
539 | 537 | ||
540 | void kmem_cache_destroy(struct kmem_cache *c) | 538 | void kmem_cache_destroy(struct kmem_cache *c) |
541 | { | 539 | { |