git: 1573dad63632 - stable/13 - vfs: retire vnlru_under_unlocked

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

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

commit 1573dad63632b2545516e3aa9b5bfc9a0f06281a
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-09-14 23:05:51 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-10-04 12:04:16 +0000

    vfs: retire vnlru_under_unlocked
    
    It only looks at the centralized value which in corner cases can end up
    being negative.
    
    (cherry picked from commit ba5dc166e0f390c703042910b637a83c705c8af3)
---
 sys/kern/vfs_subr.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 41fd5052968c..04bc26014db7 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1543,23 +1543,6 @@ vnlru_under(u_long rnumvnodes, u_long limit)
 	return (space < limit);
 }
 
-static bool
-vnlru_under_unlocked(u_long rnumvnodes, u_long limit)
-{
-	long rfreevnodes, space;
-
-	if (__predict_false(rnumvnodes > desiredvnodes))
-		return (true);
-
-	space = desiredvnodes - rnumvnodes;
-	if (space < limit) {
-		rfreevnodes = atomic_load_long(&freevnodes);
-		if (rfreevnodes > wantfreevnodes)
-			space += rfreevnodes - wantfreevnodes;
-	}
-	return (space < limit);
-}
-
 static void
 vnlru_kick_locked(void)
 {
@@ -1842,7 +1825,7 @@ vn_alloc(struct mount *mp)
 	if (__predict_false(vn_alloc_cyclecount != 0))
 		return (vn_alloc_hard(mp));
 	rnumvnodes = atomic_fetchadd_long(&numvnodes, 1) + 1;
-	if (__predict_false(vnlru_under_unlocked(rnumvnodes, vlowat))) {
+	if (__predict_false(vnlru_under(rnumvnodes, vlowat))) {
 		atomic_subtract_long(&numvnodes, 1);
 		return (vn_alloc_hard(mp));
 	}