git: c16d0924dbb6 - releng/14.2 - Revert commit 8733bc277a383cf59f38a83956f4f523869cfc90

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Fri, 15 Nov 2024 23:30:52 UTC
The branch releng/14.2 has been updated by cperciva:

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

commit c16d0924dbb6c1152c45f85b61894ba5dd61e587
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2024-11-13 19:37:14 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-11-15 23:23:13 +0000

    Revert commit 8733bc277a383cf59f38a83956f4f523869cfc90
    
    Author: Mateusz Guzik <mjg@FreeBSD.org>
    Date:   Thu Sep 14 16:13:01 2023 +0000
    
        vfs: don't provoke recycling non-free vnodes without a good reason
    
        If the total number of free vnodes is at or above target, there is no
        point creating more of them.
    
    This commit was done as a performance optimization but ends up
    causing slowdowns when doing operations on many files.
    
    Approved by:    re (cperciva)
    Requested by:   re (cperciva)
    
    (cherry picked from commit ab05a1cf321aca0fe632c1ab40f68630b477422c)
    (cherry picked from commit 2ca9c96dc0cf0d1f91b37346bce8fd0dd1639ddd)
---
 sys/kern/vfs_subr.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 646339987ba2..747cdf722cc9 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1961,25 +1961,11 @@ vn_alloc_hard(struct mount *mp, u_long rnumvnodes, bool bumped)
 
 	mtx_lock(&vnode_list_mtx);
 
-	if (vn_alloc_cyclecount != 0) {
-		rnumvnodes = atomic_load_long(&numvnodes);
-		if (rnumvnodes + 1 < desiredvnodes) {
-			vn_alloc_cyclecount = 0;
-			mtx_unlock(&vnode_list_mtx);
-			goto alloc;
-		}
-
-		rfreevnodes = vnlru_read_freevnodes();
-		if (rfreevnodes < wantfreevnodes) {
-			if (vn_alloc_cyclecount++ >= rfreevnodes) {
-				vn_alloc_cyclecount = 0;
-				vstir = true;
-			}
-		} else {
-			vn_alloc_cyclecount = 0;
-		}
+	rfreevnodes = vnlru_read_freevnodes();
+	if (vn_alloc_cyclecount++ >= rfreevnodes) {
+		vn_alloc_cyclecount = 0;
+		vstir = true;
 	}
-
 	/*
 	 * Grow the vnode cache if it will not be above its target max
 	 * after growing.  Otherwise, if the free list is nonempty, try