Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163255080
D22766.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D22766.diff
View Options
Index: head/sys/vm/uma_core.c
===================================================================
--- head/sys/vm/uma_core.c
+++ head/sys/vm/uma_core.c
@@ -290,6 +290,7 @@
static int sysctl_handle_uma_zone_allocs(SYSCTL_HANDLER_ARGS);
static int sysctl_handle_uma_zone_frees(SYSCTL_HANDLER_ARGS);
static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER_ARGS);
+static int sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS);
#ifdef INVARIANTS
static inline struct noslabbits *slab_dbg_bits(uma_slab_t slab, uma_keg_t keg);
@@ -1948,6 +1949,10 @@
SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
"free", CTLFLAG_RD, &keg->uk_free, 0,
"items free in the slab layer");
+ SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
+ "efficiency", CTLFLAG_RD | CTLTYPE_INT | CTLFLAG_MPSAFE,
+ keg, 0, sysctl_handle_uma_slab_efficiency, "I",
+ "Slab utilization (100 - internal fragmentation %)");
} else
SYSCTL_ADD_CONST_STRING(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
"name", CTLFLAG_RD, nokeg, "Keg name");
@@ -4438,6 +4443,27 @@
sbuf_delete(&sbuf);
return (error);
+}
+
+static int
+sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS)
+{
+ uma_keg_t keg = arg1;
+ int avail, effpct, total;
+
+ total = keg->uk_ppera * PAGE_SIZE;
+ if ((keg->uk_flags & UMA_ZONE_OFFPAGE) != 0)
+ total += slab_sizeof(SLAB_MAX_SETSIZE);
+ /*
+ * We consider the client's requested size and alignment here, not the
+ * real size determination uk_rsize, because we also adjust the real
+ * size for internal implementation reasons (max bitset size).
+ */
+ avail = keg->uk_ipers * roundup2(keg->uk_size, keg->uk_align + 1);
+ if ((keg->uk_flags & UMA_ZONE_PCPU) != 0)
+ avail *= mp_maxid + 1;
+ effpct = 100 * avail / total;
+ return (sysctl_handle_int(oidp, &effpct, 0, req));
}
#ifdef INVARIANTS
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 22, 11:36 AM (3 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35362803
Default Alt Text
D22766.diff (1 KB)
Attached To
Mode
D22766: uma: report waste per slab
Attached
Detach File
Event Timeline
Log In to Comment