Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330440
b: refs/heads/master
c: cbb7969
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Lameter authored and Pekka Enberg committed Sep 5, 2012
1 parent 14d75e7 commit c7745a3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db265eca77000c5dafc5608975afe8dafb2a02d5
refs/heads/master: cbb79694d592e9a76880f6ef6db8feccaeee1c32
10 changes: 10 additions & 0 deletions trunk/mm/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ extern struct kmem_cache *kmem_cache;
struct kmem_cache *__kmem_cache_create(const char *name, size_t size,
size_t align, unsigned long flags, void (*ctor)(void *));

#ifdef CONFIG_SLUB
struct kmem_cache *__kmem_cache_alias(const char *name, size_t size,
size_t align, unsigned long flags, void (*ctor)(void *));
#else
static inline struct kmem_cache *__kmem_cache_alias(const char *name, size_t size,
size_t align, unsigned long flags, void (*ctor)(void *))
{ return NULL; }
#endif


int __kmem_cache_shutdown(struct kmem_cache *);

#endif
4 changes: 4 additions & 0 deletions trunk/mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align
goto out_locked;
}

s = __kmem_cache_alias(name, size, align, flags, ctor);
if (s)
goto out_locked;

s = __kmem_cache_create(n, size, align, flags, ctor);

if (s) {
Expand Down
15 changes: 11 additions & 4 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@ void __init kmem_cache_init(void)
slub_max_order = 0;

kmem_size = offsetof(struct kmem_cache, node) +
nr_node_ids * sizeof(struct kmem_cache_node *);
nr_node_ids * sizeof(struct kmem_cache_node *);

/* Allocate two kmem_caches from the page allocator */
kmalloc_size = ALIGN(kmem_size, cache_line_size());
Expand Down Expand Up @@ -3922,7 +3922,7 @@ static struct kmem_cache *find_mergeable(size_t size,
return NULL;
}

struct kmem_cache *__kmem_cache_create(const char *name, size_t size,
struct kmem_cache *__kmem_cache_alias(const char *name, size_t size,
size_t align, unsigned long flags, void (*ctor)(void *))
{
struct kmem_cache *s;
Expand All @@ -3939,11 +3939,18 @@ struct kmem_cache *__kmem_cache_create(const char *name, size_t size,

if (sysfs_slab_alias(s, name)) {
s->refcount--;
return NULL;
s = NULL;
}
return s;
}

return s;
}

struct kmem_cache *__kmem_cache_create(const char *name, size_t size,
size_t align, unsigned long flags, void (*ctor)(void *))
{
struct kmem_cache *s;

s = kmem_cache_alloc(kmem_cache, GFP_KERNEL);
if (s) {
if (kmem_cache_open(s, name,
Expand Down

0 comments on commit c7745a3

Please sign in to comment.