some arc_reclaim_needed stats

Andriy Gapon avg at icyb.net.ua
Fri Apr 16 13:58:14 UTC 2010


I added some statistics gathering code to arc_reclaim_needed (see a diff below)
and got these results:

vfs.zfs.arc_reclaim_kmem_used: 192
vfs.zfs.arc_reclaim_paging_target: 72505
vfs.zfs.arc_reclaim_pages_needed: 17
vfs.zfs.arc_reclaim_arc_c_max: 150
vfs.zfs.arc_reclaim_needfree: 1693

Are these numbers useful in any way? :-)
What do they tell?
Perhaps vm_paging_target() check is a bit too aggressive?

Thanks!


diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
index ca8ffb1..6db69e1 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -2040,6 +2040,24 @@ arc_shrink(void)

 static int needfree = 0;

+static int arc_reclaim_needfree = 0;
+static int arc_reclaim_arc_c_max = 0;
+static int arc_reclaim_pages_needed = 0;
+static int arc_reclaim_paging_target = 0;
+static int arc_reclaim_kmem_used = 0;
+
+SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_needfree, CTLFLAG_RD,
+    &arc_reclaim_needfree, 0, "Later");
+SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_arc_c_max, CTLFLAG_RD,
+    &arc_reclaim_arc_c_max, 0, "Later");
+SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_pages_needed, CTLFLAG_RD,
+    &arc_reclaim_pages_needed, 0, "Later");
+SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_paging_target, CTLFLAG_RD,
+    &arc_reclaim_paging_target, 0, "Later");
+SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_kmem_used, CTLFLAG_RD,
+    &arc_reclaim_kmem_used, 0, "Later");
+
+/* XXX AVG ZFS BOOKMARK */
 static int
 arc_reclaim_needed(void)
 {
@@ -2048,10 +2066,14 @@ arc_reclaim_needed(void)
 #endif

 #ifdef _KERNEL
-	if (needfree)
+	if (needfree) {
+		arc_reclaim_needfree++;
 		return (1);
-	if (arc_size > arc_c_max)
+	}
+	if (arc_size > arc_c_max) {
+		arc_reclaim_arc_c_max++;
 		return (1);
+	}
 	if (arc_size <= arc_c_min)
 		return (0);

@@ -2059,8 +2081,14 @@ arc_reclaim_needed(void)
 	 * If pages are needed or we're within 2048 pages
 	 * of needing to page need to reclaim
 	 */
-	if (vm_pages_needed || (vm_paging_target() > -2048))
+	if (vm_pages_needed) {
+		arc_reclaim_pages_needed++;
+		return (1);
+	}
+	if ((vm_paging_target() > -2048)) {
+		arc_reclaim_paging_target++;
 		return (1);
+	}

 #if 0
 	/*
@@ -2105,8 +2133,10 @@ arc_reclaim_needed(void)
 		return (1);
 #endif
 #else
-	if (kmem_used() > (kmem_size() * 3) / 4)
+	if (kmem_used() > (kmem_size() * 3) / 4) {
+		arc_reclaim_kmem_used++;
 		return (1);
+	}
 #endif

 #else

-- 
Andriy Gapon


More information about the freebsd-fs mailing list