git: 76f1153790b6 - main - vfs: don't kick vnlru if it is already running

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Thu, 14 Sep 2023 16:40:19 UTC
The branch main has been updated by mjg:

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

commit 76f1153790b6d2e1a4f0389c3ac24e41d08f9ba6
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-09-14 16:27:47 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-09-14 16:40:14 +0000

    vfs: don't kick vnlru if it is already running
    
    Further shaves some lock trips.
---
 sys/kern/vfs_subr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 80ec15f78028..4c9cb6200f10 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1557,9 +1557,11 @@ vnlru_kick_locked(void)
 }
 
 static void
-vnlru_kick(void)
+vnlru_kick_cond(void)
 {
 
+	if (vnlruproc_sig)
+		return;
 	mtx_lock(&vnode_list_mtx);
 	vnlru_kick_locked();
 	mtx_unlock(&vnode_list_mtx);
@@ -1812,7 +1814,7 @@ alloc:
 	mtx_assert(&vnode_list_mtx, MA_NOTOWNED);
 	rnumvnodes = atomic_fetchadd_long(&numvnodes, 1) + 1;
 	if (vnlru_under(rnumvnodes, vlowat))
-		vnlru_kick();
+		vnlru_kick_cond();
 	return (uma_zalloc_smr(vnode_zone, M_WAITOK));
 }