git: decacbe47c3e - releng/14.0 - vfs: count calls to uma_reclaim in vnlru

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Sat, 14 Oct 2023 01:08:58 UTC
The branch releng/14.0 has been updated by mjg:

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

commit decacbe47c3e5948638bf368a3ac3d68a5a9b95f
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-10-11 22:48:03 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-10-14 01:08:09 +0000

    vfs: count calls to uma_reclaim in vnlru
    
    (cherry picked from commit bb679b0c49094757f2aef3d8fe46c41dc8192fea)
    (cherry picked from commit c1ffb1ffeeac1b3968bf3eae5195b49e1c33b542)
    
    Approved by:    re (gjb)
---
 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;