From efb9352700ba95f349522689679b7c7949e66245 Mon Sep 17 00:00:00 2001 From: Xiongwei Song Date: Tue, 31 May 2022 08:55:50 +0800 Subject: 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 Reviewed-by: Muchun Song Link: https://lore.kernel.org/all/e5ebc952-af17-321f-5343-bc914d47c931@suse.cz/ Signed-off-by: Vlastimil Babka --- mm/slub.c | 8 +++----- 1 file 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; -- cgit v1.2.3