[PATCH] slab: fix the alias count(via sysfs) of slab cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We mark some slabs(e.g. kmem_cache_node) as unmergeable via setting
refcount to -1, and their alias should be 0, not refcount-1, so correct
it here.

Signed-off-by: Gu Zheng <guz.fnst@xxxxxxxxxxxxxx>
---
 mm/slub.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 7300480..ac1a20a 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4509,7 +4509,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);
 
-- 
1.7.7

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]