Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148475945
D22766.id65503.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.id65503.diff
View Options
Index: sys/vm/uma_core.c
===================================================================
--- sys/vm/uma_core.c
+++ 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_waste(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,
+ "waste", CTLFLAG_RD | CTLTYPE_INT | CTLFLAG_MPSAFE,
+ keg, 0, sysctl_handle_uma_slab_waste, "I",
+ "Internal fragmentation per-slab");
} else
SYSCTL_ADD_CONST_STRING(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
"name", CTLFLAG_RD, nokeg, "Keg name");
@@ -4440,6 +4445,22 @@
return (error);
}
+static int
+sysctl_handle_uma_slab_waste(SYSCTL_HANDLER_ARGS)
+{
+ uma_keg_t keg = arg1;
+ int waste;
+
+ waste = keg->uk_ppera * (PAGE_SIZE + sizeof(struct vm_page));
+ if ((keg->uk_flags & UMA_ZONE_OFFPAGE) != 0)
+ waste += slab_sizeof(SLAB_MAX_SETSIZE);
+ if ((keg->uk_flags & UMA_ZONE_PCPU) != 0)
+ waste /= mp_maxid + 1;
+ /* The size actually usable by the client is uk_size, not uk_rsize. */
+ waste -= roundup2(keg->uk_size, keg->uk_align + 1) * keg->uk_ipers;
+ return (sysctl_handle_int(oidp, &waste, 0, req));
+}
+
#ifdef INVARIANTS
static uma_slab_t
uma_dbg_getslab(uma_zone_t zone, void *item)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 19, 3:42 AM (47 m, 9 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29943238
Default Alt Text
D22766.id65503.diff (1 KB)
Attached To
Mode
D22766: uma: report waste per slab
Attached
Detach File
Event Timeline
Log In to Comment