git: 3a99c0acc1e6 - stable/13 - vfs: don't kick vnlru if it is already running

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Wed, 04 Oct 2023 12:08:50 UTC
The branch stable/13 has been updated by mjg:

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

commit 3a99c0acc1e6184862ab83b173fe740ccff9c3f6
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-09-14 16:27:47 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-10-04 12:04:15 +0000

    vfs: don't kick vnlru if it is already running
    
    Further shaves some lock trips.
    
    (cherry picked from commit 76f1153790b6d2e1a4f0389c3ac24e41d08f9ba6)
---
 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 40f7a6d33c20..f58c8920dc4f 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1572,9 +1572,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);
@@ -1828,7 +1830,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));
 }