From 2ea531b264df97bfea7d74c7f9414b2d3c5d4277 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Thu, 14 Sep 2023 16:27:47 +0000 Subject: [PATCH] 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 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 @@ vn_alloc_hard(struct mount *mp) 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)); }