git: 35f36c3ee64f - stable/13 - vfs: track how many times vn_alloc blocked on hitting the vnode limit

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Fri, 25 Aug 2023 22:57:50 UTC
The branch stable/13 has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=35f36c3ee64f5066c3de7162b1d0558c1776dd00

commit 35f36c3ee64f5066c3de7162b1d0558c1776dd00
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-08-18 23:56:58 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-08-25 22:56:40 +0000

    vfs: track how many times vn_alloc blocked on hitting the vnode limit
    
    (cherry picked from commit 64e881f2db968bf10c4aa22668ea270e1b9dd3c1)
---
 sys/kern/vfs_subr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 57e619abaa15..5cdefca60e7c 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1728,6 +1728,10 @@ vtryrecycle(struct vnode *vp)
  * vnlru to clear things up, but ultimately always performs a M_WAITOK allocation.
  */
 static u_long vn_alloc_cyclecount;
+static u_long vn_alloc_sleeps;
+
+SYSCTL_ULONG(_vfs, OID_AUTO, vnode_alloc_sleeps, CTLFLAG_RD, &vn_alloc_sleeps, 0,
+    "Number of times vnode allocation blocked waiting on vnlru");
 
 static struct vnode * __noinline
 vn_alloc_hard(struct mount *mp)
@@ -1762,6 +1766,7 @@ vn_alloc_hard(struct mount *mp)
 		 * Wait for space for a new vnode.
 		 */
 		vnlru_kick();
+		vn_alloc_sleeps++;
 		msleep(&vnlruproc_sig, &vnode_list_mtx, PVFS, "vlruwk", hz);
 		if (atomic_load_long(&numvnodes) + 1 > desiredvnodes &&
 		    vnlru_read_freevnodes() > 1)