Skip to content

Commit

Permalink
mm/sl[aou]b: Move kmem_cache refcounting to common code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Lameter authored and penberg committed Sep 5, 2012
1 parent 8a13a4c commit cce89f4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,6 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
*/
BUG_ON(ZERO_OR_NULL_PTR(cachep->slabp_cache));
}
cachep->refcount = 1;

err = setup_cpu_cache(cachep, gfp);
if (err) {
Expand Down
5 changes: 3 additions & 2 deletions mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align
}

err = __kmem_cache_create(s, flags);
if (!err)
if (!err) {

s->refcount = 1;
list_add(&s->list, &slab_caches);

else {
} else {
kfree(s->name);
kmem_cache_free(kmem_cache, s);
}
Expand Down
1 change: 0 additions & 1 deletion mm/slob.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,6 @@ int __kmem_cache_create(struct kmem_cache *c, unsigned long flags)
if (c->align < align)
c->align = align;

c->refcount = 1;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -3093,7 +3093,6 @@ static int kmem_cache_open(struct kmem_cache *s, unsigned long flags)
else
s->cpu_partial = 30;

s->refcount = 1;
#ifdef CONFIG_NUMA
s->remote_node_defrag_ratio = 1000;
#endif
Expand Down

0 comments on commit cce89f4

Please sign in to comment.