Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330445
b: refs/heads/master
c: aac3a16
h: refs/heads/master
i:
  330443: af6bae8
v: v3
  • Loading branch information
Pekka Enberg committed Sep 5, 2012
1 parent a126a60 commit 3a8526f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 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: cce89f4f6911286500cf7be0363f46c9b0a12ce0
refs/heads/master: aac3a1664aba429f47c70edfc76ee10fcd808471
3 changes: 0 additions & 3 deletions trunk/mm/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,10 @@ extern int __kmem_cache_create(struct kmem_cache *, unsigned long flags);
#ifdef CONFIG_SLUB
struct kmem_cache *__kmem_cache_alias(const char *name, size_t size,
size_t align, unsigned long flags, void (*ctor)(void *));
extern int sysfs_slab_add(struct kmem_cache *s);
#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; }
static inline int sysfs_slab_add(struct kmem_cache *s) { return 0; }

#endif


Expand Down
8 changes: 0 additions & 8 deletions trunk/mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,6 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align
return NULL;
}

if (s->refcount == 1) {
err = sysfs_slab_add(s);
if (err)
printk(KERN_WARNING "kmem_cache_create(%s) failed to"
" create sysfs entry. Error %d\n",
name, err);
}

return s;
}
EXPORT_SYMBOL(kmem_cache_create);
Expand Down
19 changes: 17 additions & 2 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,12 @@ struct track {
enum track_item { TRACK_ALLOC, TRACK_FREE };

#ifdef CONFIG_SYSFS
static int sysfs_slab_add(struct kmem_cache *);
static int sysfs_slab_alias(struct kmem_cache *, const char *);
static void sysfs_slab_remove(struct kmem_cache *);

#else
static inline int sysfs_slab_add(struct kmem_cache *s) { return 0; }
static inline int sysfs_slab_alias(struct kmem_cache *s, const char *p)
{ return 0; }
static inline void sysfs_slab_remove(struct kmem_cache *s) { }
Expand Down Expand Up @@ -3943,7 +3945,20 @@ struct kmem_cache *__kmem_cache_alias(const char *name, size_t size,

int __kmem_cache_create(struct kmem_cache *s, unsigned long flags)
{
return kmem_cache_open(s, flags);
int err;

err = kmem_cache_open(s, flags);
if (err)
return err;

mutex_unlock(&slab_mutex);
err = sysfs_slab_add(s);
mutex_lock(&slab_mutex);

if (err)
kmem_cache_close(s);

return err;
}

#ifdef CONFIG_SMP
Expand Down Expand Up @@ -5233,7 +5248,7 @@ static char *create_unique_id(struct kmem_cache *s)
return name;
}

int sysfs_slab_add(struct kmem_cache *s)
static int sysfs_slab_add(struct kmem_cache *s)
{
int err;
const char *name;
Expand Down

0 comments on commit 3a8526f

Please sign in to comment.