diff options
author | Christoph Lameter <cl@linux.com> | 2012-09-04 19:38:33 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-09-05 05:00:37 -0400 |
commit | cce89f4f6911286500cf7be0363f46c9b0a12ce0 (patch) | |
tree | c60d648404ea213d2f3d657c64fb86b2243e6a89 /mm | |
parent | 8a13a4cc80bb25c9eab2e7e56bab724fcfa55fce (diff) |
mm/sl[aou]b: Move kmem_cache refcounting to common code
Get rid of the refcount stuff in the allocators and do that part of
kmem_cache management in the common code.
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 1 | ||||
-rw-r--r-- | mm/slab_common.c | 5 | ||||
-rw-r--r-- | mm/slob.c | 1 | ||||
-rw-r--r-- | mm/slub.c | 1 |
4 files changed, 3 insertions, 5 deletions
@@ -2555,7 +2555,6 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) | |||
2555 | */ | 2555 | */ |
2556 | BUG_ON(ZERO_OR_NULL_PTR(cachep->slabp_cache)); | 2556 | BUG_ON(ZERO_OR_NULL_PTR(cachep->slabp_cache)); |
2557 | } | 2557 | } |
2558 | cachep->refcount = 1; | ||
2559 | 2558 | ||
2560 | err = setup_cpu_cache(cachep, gfp); | 2559 | err = setup_cpu_cache(cachep, gfp); |
2561 | if (err) { | 2560 | if (err) { |
diff --git a/mm/slab_common.c b/mm/slab_common.c index 8a85a19d90ef..651a3c60847a 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -125,11 +125,12 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align | |||
125 | } | 125 | } |
126 | 126 | ||
127 | err = __kmem_cache_create(s, flags); | 127 | err = __kmem_cache_create(s, flags); |
128 | if (!err) | 128 | if (!err) { |
129 | 129 | ||
130 | s->refcount = 1; | ||
130 | list_add(&s->list, &slab_caches); | 131 | list_add(&s->list, &slab_caches); |
131 | 132 | ||
132 | else { | 133 | } else { |
133 | kfree(s->name); | 134 | kfree(s->name); |
134 | kmem_cache_free(kmem_cache, s); | 135 | kmem_cache_free(kmem_cache, s); |
135 | } | 136 | } |
@@ -524,7 +524,6 @@ int __kmem_cache_create(struct kmem_cache *c, unsigned long flags) | |||
524 | if (c->align < align) | 524 | if (c->align < align) |
525 | c->align = align; | 525 | c->align = align; |
526 | 526 | ||
527 | c->refcount = 1; | ||
528 | return 0; | 527 | return 0; |
529 | } | 528 | } |
530 | 529 | ||
@@ -3093,7 +3093,6 @@ static int kmem_cache_open(struct kmem_cache *s, unsigned long flags) | |||
3093 | else | 3093 | else |
3094 | s->cpu_partial = 30; | 3094 | s->cpu_partial = 30; |
3095 | 3095 | ||
3096 | s->refcount = 1; | ||
3097 | #ifdef CONFIG_NUMA | 3096 | #ifdef CONFIG_NUMA |
3098 | s->remote_node_defrag_ratio = 1000; | 3097 | s->remote_node_defrag_ratio = 1000; |
3099 | #endif | 3098 | #endif |