diff options
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -3636,13 +3636,10 @@ struct kmem_cache * | |||
3636 | __kmem_cache_alias(const char *name, size_t size, size_t align, | 3636 | __kmem_cache_alias(const char *name, size_t size, size_t align, |
3637 | unsigned long flags, void (*ctor)(void *)) | 3637 | unsigned long flags, void (*ctor)(void *)) |
3638 | { | 3638 | { |
3639 | struct kmem_cache *s; | 3639 | struct kmem_cache *s, *c; |
3640 | 3640 | ||
3641 | s = find_mergeable(size, align, flags, name, ctor); | 3641 | s = find_mergeable(size, align, flags, name, ctor); |
3642 | if (s) { | 3642 | if (s) { |
3643 | int i; | ||
3644 | struct kmem_cache *c; | ||
3645 | |||
3646 | s->refcount++; | 3643 | s->refcount++; |
3647 | 3644 | ||
3648 | /* | 3645 | /* |
@@ -3652,10 +3649,7 @@ __kmem_cache_alias(const char *name, size_t size, size_t align, | |||
3652 | s->object_size = max(s->object_size, (int)size); | 3649 | s->object_size = max(s->object_size, (int)size); |
3653 | s->inuse = max_t(int, s->inuse, ALIGN(size, sizeof(void *))); | 3650 | s->inuse = max_t(int, s->inuse, ALIGN(size, sizeof(void *))); |
3654 | 3651 | ||
3655 | for_each_memcg_cache_index(i) { | 3652 | for_each_memcg_cache(c, s) { |
3656 | c = cache_from_memcg_idx(s, i); | ||
3657 | if (!c) | ||
3658 | continue; | ||
3659 | c->object_size = s->object_size; | 3653 | c->object_size = s->object_size; |
3660 | c->inuse = max_t(int, c->inuse, | 3654 | c->inuse = max_t(int, c->inuse, |
3661 | ALIGN(size, sizeof(void *))); | 3655 | ALIGN(size, sizeof(void *))); |
@@ -4921,7 +4915,7 @@ static ssize_t slab_attr_store(struct kobject *kobj, | |||
4921 | err = attribute->store(s, buf, len); | 4915 | err = attribute->store(s, buf, len); |
4922 | #ifdef CONFIG_MEMCG_KMEM | 4916 | #ifdef CONFIG_MEMCG_KMEM |
4923 | if (slab_state >= FULL && err >= 0 && is_root_cache(s)) { | 4917 | if (slab_state >= FULL && err >= 0 && is_root_cache(s)) { |
4924 | int i; | 4918 | struct kmem_cache *c; |
4925 | 4919 | ||
4926 | mutex_lock(&slab_mutex); | 4920 | mutex_lock(&slab_mutex); |
4927 | if (s->max_attr_size < len) | 4921 | if (s->max_attr_size < len) |
@@ -4944,11 +4938,8 @@ static ssize_t slab_attr_store(struct kobject *kobj, | |||
4944 | * directly either failed or succeeded, in which case we loop | 4938 | * directly either failed or succeeded, in which case we loop |
4945 | * through the descendants with best-effort propagation. | 4939 | * through the descendants with best-effort propagation. |
4946 | */ | 4940 | */ |
4947 | for_each_memcg_cache_index(i) { | 4941 | for_each_memcg_cache(c, s) |
4948 | struct kmem_cache *c = cache_from_memcg_idx(s, i); | 4942 | attribute->store(c, buf, len); |
4949 | if (c) | ||
4950 | attribute->store(c, buf, len); | ||
4951 | } | ||
4952 | mutex_unlock(&slab_mutex); | 4943 | mutex_unlock(&slab_mutex); |
4953 | } | 4944 | } |
4954 | #endif | 4945 | #endif |