diff options
author | Xiongwei Song <xiongwei.song@windriver.com> | 2022-05-31 08:55:50 +0800 |
---|---|---|
committer | Vlastimil Babka <vbabka@suse.cz> | 2022-07-04 17:08:47 +0200 |
commit | efb9352700ba95f349522689679b7c7949e66245 (patch) | |
tree | b6074485018b195339d2653be75e9c830972d494 | |
parent | d1ca263d0d518b4918473768aee0cfb2770014bc (diff) |
mm/slub: Simplify __kmem_cache_alias()
There is no need to do anything if sysfs_slab_alias() return nonzero
value after getting a mergeable cache.
Signed-off-by: Xiongwei Song <xiongwei.song@windriver.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Link: https://lore.kernel.org/all/e5ebc952-af17-321f-5343-bc914d47c931@suse.cz/
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
-rw-r--r-- | mm/slub.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/mm/slub.c b/mm/slub.c index b1281b8654bd..c21edf51e99f 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4890,6 +4890,9 @@ __kmem_cache_alias(const char *name, unsigned int size, unsigned int align, s = find_mergeable(size, align, flags, name, ctor); if (s) { + if (sysfs_slab_alias(s, name)) + return NULL; + s->refcount++; /* @@ -4898,11 +4901,6 @@ __kmem_cache_alias(const char *name, unsigned int size, unsigned int align, */ s->object_size = max(s->object_size, size); s->inuse = max(s->inuse, ALIGN(size, sizeof(void *))); - - if (sysfs_slab_alias(s, name)) { - s->refcount--; - s = NULL; - } } return s; |