summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/include/slabinfo.h2
-rw-r--r--library/slabinfo.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/library/include/slabinfo.h b/library/include/slabinfo.h
index 128bad9..f63ca79 100644
--- a/library/include/slabinfo.h
+++ b/library/include/slabinfo.h
@@ -40,7 +40,7 @@ enum slabinfo_item {
SLAB_ACTIVE_SLABS, // u_int "
SLAB_PAGES_PER_SLAB, // u_int "
SLAB_PERCENT_USED, // u_int derived from ACTIVE_OBJS / NUM_OBJS
- SLAB_SIZE_TOTAL, // ul_int derived from page size * NUM_OBJS * PAGES_PER_SLAB
+ SLAB_SIZE_TOTAL, // ul_int derived from page size * NUMS_SLABS * PAGES_PER_SLAB
SLABS_CACHES_TOTAL, // u_int derived from all caches
SLABS_CACHES_ACTIVE, // u_int "
diff --git a/library/slabinfo.c b/library/slabinfo.c
index a4386d6..1d4453f 100644
--- a/library/slabinfo.c
+++ b/library/slabinfo.c
@@ -434,6 +434,10 @@ static int parse_slabinfo20 (
if (node->obj_size > slabs->max_obj_size)
slabs->max_obj_size = node->obj_size;
+ /* cache_size is not accurate, it's the upper limit of memory used by this slab.
+ * When system using slub(most common case) is under high memory pressure, there
+ * are slab order fallbacks, which means pages_per_slab is not constant and may decrease.
+ */
node->cache_size = (unsigned long)node->nr_slabs * node->pages_per_slab * page_size;
if (node->nr_objs) {