svn commit: r280912 - in stable: 10/sys/kern 9/sys/kern
John Baldwin
jhb at FreeBSD.org
Tue Mar 31 15:37:27 UTC 2015
Author: jhb
Date: Tue Mar 31 15:37:24 2015
New Revision: 280912
URL: https://svnweb.freebsd.org/changeset/base/280912
Log:
MFC 278760:
Add two new counters for vnode life cycle events:
- vfs.recycles counts the number of vnodes forcefully recycled to avoid
exceeding kern.maxvnodes.
- vfs.vnodes_created counts the number of vnodes created by successful
calls to getnewvnode().
Modified:
stable/9/sys/kern/vfs_subr.c
Directory Properties:
stable/9/sys/ (props changed)
Changes in other areas also in this revision:
Modified:
stable/10/sys/kern/vfs_subr.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/9/sys/kern/vfs_subr.c
==============================================================================
--- stable/9/sys/kern/vfs_subr.c Tue Mar 31 15:03:58 2015 (r280911)
+++ stable/9/sys/kern/vfs_subr.c Tue Mar 31 15:37:24 2015 (r280912)
@@ -123,6 +123,10 @@ static unsigned long numvnodes;
SYSCTL_ULONG(_vfs, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0,
"Number of vnodes in existence");
+static u_long vnodes_created;
+SYSCTL_ULONG(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created,
+ 0, "Number of vnodes created by getnewvnode");
+
/*
* Conversion tables for conversion from vnode types to inode formats
* and back.
@@ -157,6 +161,10 @@ static int vlru_allow_cache_src;
SYSCTL_INT(_vfs, OID_AUTO, vlru_allow_cache_src, CTLFLAG_RW,
&vlru_allow_cache_src, 0, "Allow vlru to reclaim source vnode");
+static u_long recycles_count;
+SYSCTL_ULONG(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, 0,
+ "Number of vnodes recycled to avoid exceding kern.maxvnodes");
+
/*
* Various variables used for debugging the new implementation of
* reassignbuf().
@@ -769,6 +777,7 @@ vlrureclaim(struct mount *mp)
}
KASSERT((vp->v_iflag & VI_DOOMED) == 0,
("VI_DOOMED unexpectedly detected in vlrureclaim()"));
+ atomic_add_long(&recycles_count, 1);
vgonel(vp);
VOP_UNLOCK(vp, 0);
vdropl(vp);
@@ -964,8 +973,10 @@ vtryrecycle(struct vnode *vp)
__func__, vp);
return (EBUSY);
}
- if ((vp->v_iflag & VI_DOOMED) == 0)
+ if ((vp->v_iflag & VI_DOOMED) == 0) {
+ atomic_add_long(&recycles_count, 1);
vgonel(vp);
+ }
VOP_UNLOCK(vp, LK_INTERLOCK);
vn_finished_write(vnmp);
return (0);
@@ -1069,6 +1080,7 @@ getnewvnode(const char *tag, struct moun
atomic_add_long(&numvnodes, 1);
mtx_unlock(&vnode_free_list_mtx);
alloc:
+ atomic_add_long(&vnodes_created, 1);
vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK|M_ZERO);
/*
* Setup locks.
More information about the svn-src-stable-9
mailing list