diff options
author | Christoph Lameter <cl@linux.com> | 2012-07-06 16:25:11 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-07-09 05:13:35 -0400 |
commit | 97d06609158e61f6bdf538c4a6788e2de492236f (patch) | |
tree | fa3f57ff3e2d3f4f866d84dd9d634ade43941be8 /mm/slob.c | |
parent | 039363f38bfe5f6281e9eae5e0518b11577d9d50 (diff) |
mm, sl[aou]b: Common definition for boot state of the slab allocators
All allocators have some sort of support for the bootstrap status.
Setup a common definition for the boot states and make all slab
allocators use that definition.
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/slob.c')
-rw-r--r-- | mm/slob.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -59,6 +59,8 @@ | |||
59 | 59 | ||
60 | #include <linux/kernel.h> | 60 | #include <linux/kernel.h> |
61 | #include <linux/slab.h> | 61 | #include <linux/slab.h> |
62 | #include "slab.h" | ||
63 | |||
62 | #include <linux/mm.h> | 64 | #include <linux/mm.h> |
63 | #include <linux/swap.h> /* struct reclaim_state */ | 65 | #include <linux/swap.h> /* struct reclaim_state */ |
64 | #include <linux/cache.h> | 66 | #include <linux/cache.h> |
@@ -531,6 +533,7 @@ struct kmem_cache *__kmem_cache_create(const char *name, size_t size, | |||
531 | c->align = align; | 533 | c->align = align; |
532 | 534 | ||
533 | kmemleak_alloc(c, sizeof(struct kmem_cache), 1, GFP_KERNEL); | 535 | kmemleak_alloc(c, sizeof(struct kmem_cache), 1, GFP_KERNEL); |
536 | c->refcount = 1; | ||
534 | } | 537 | } |
535 | return c; | 538 | return c; |
536 | } | 539 | } |
@@ -616,19 +619,12 @@ int kmem_cache_shrink(struct kmem_cache *d) | |||
616 | } | 619 | } |
617 | EXPORT_SYMBOL(kmem_cache_shrink); | 620 | EXPORT_SYMBOL(kmem_cache_shrink); |
618 | 621 | ||
619 | static unsigned int slob_ready __read_mostly; | ||
620 | |||
621 | int slab_is_available(void) | ||
622 | { | ||
623 | return slob_ready; | ||
624 | } | ||
625 | |||
626 | void __init kmem_cache_init(void) | 622 | void __init kmem_cache_init(void) |
627 | { | 623 | { |
628 | slob_ready = 1; | 624 | slab_state = UP; |
629 | } | 625 | } |
630 | 626 | ||
631 | void __init kmem_cache_init_late(void) | 627 | void __init kmem_cache_init_late(void) |
632 | { | 628 | { |
633 | /* Nothing to do */ | 629 | slab_state = FULL; |
634 | } | 630 | } |