Commit efb93527 authored by Xiongwei Song's avatar Xiongwei Song Committed by Vlastimil Babka
Browse files

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: default avatarXiongwei Song <xiongwei.song@windriver.com>
Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.com>
Link: https://lore.kernel.org/all/e5ebc952-af17-321f-5343-bc914d47c931@suse.cz/


Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
parent d1ca263d
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -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;