git: b5210f3fb260 - stable/14 - vfs: retire vnlru_under_unlocked
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 22 Sep 2023 21:51:18 UTC
The branch stable/14 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b5210f3fb26031e24f2f4c465aa3eab64002353a commit b5210f3fb26031e24f2f4c465aa3eab64002353a Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-09-14 23:05:51 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2023-09-22 21:50:47 +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 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)); }