git: bb679b0c4909 - main - vfs: count calls to uma_reclaim in vnlru

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Wed, 11 Oct 2023 22:50:24 UTC
The branch main has been updated by mjg:

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

commit bb679b0c49094757f2aef3d8fe46c41dc8192fea
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-10-11 22:48:03 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-10-11 22:49:34 +0000

    vfs: count calls to uma_reclaim in vnlru
---
 sys/kern/vfs_subr.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index d21ccb4251cd..01585ac9eefd 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1711,6 +1711,10 @@ vnlru_proc_light(void)
 	return (true);
 }
 
+static u_long uma_reclaim_calls;
+SYSCTL_ULONG(_vfs_vnode_vnlru, OID_AUTO, uma_reclaim_calls, CTLFLAG_RD | CTLFLAG_STATS,
+    &uma_reclaim_calls, 0, "Number of calls to uma_reclaim");
+
 static void
 vnlru_proc(void)
 {
@@ -1801,8 +1805,10 @@ vnlru_proc(void)
 		 * this happens.
 		 */
 		if (onumvnodes + VNLRU_COUNT_SLOP + 1000 > desiredvnodes &&
-		    numvnodes <= desiredvnodes)
+		    numvnodes <= desiredvnodes) {
+			uma_reclaim_calls++;
 			uma_reclaim(UMA_RECLAIM_DRAIN);
+		}
 		if (done == 0) {
 			if (force == 0 || force == 1) {
 				force = 2;