git: ba5dc166e0f3 - main - vfs: retire vnlru_under_unlocked

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

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

commit ba5dc166e0f390c703042910b637a83c705c8af3
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-09-14 23:05:51 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-09-14 23:05:51 +0000

    vfs: retire vnlru_under_unlocked
    
    It only looks at the centralized value which in corner cases can end up
    being negative.
---
 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 ed478d33aed0..84219f3b5c12 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1528,23 +1528,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)
 {
@@ -1826,7 +1809,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));
 	}