From 4307c14f3c77bc0cb0facfc9c67c7872505aaedf Mon Sep 17 00:00:00 2001 From: Gu Zheng Date: Wed, 6 Aug 2014 16:04:51 -0700 Subject: [PATCH] slab: fix the alias count (via sysfs) of slab cache We mark some slab caches (e.g. kmem_cache_node) as unmergeable by setting refcount to -1, and their alias should be 0, not refcount-1, so correct it here. Signed-off-by: Gu Zheng Acked-by: David Rientjes Cc: Christoph Lameter Cc: Pekka Enberg Cc: Joonsoo Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index d9aadbfe7c29..9b861b90cde1 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4466,7 +4466,7 @@ SLAB_ATTR_RO(ctor); static ssize_t aliases_show(struct kmem_cache *s, char *buf) { - return sprintf(buf, "%d\n", s->refcount - 1); + return sprintf(buf, "%d\n", s->refcount < 0 ? 0 : s->refcount - 1); } SLAB_ATTR_RO(aliases); -- 2.34.1