git: f4f4f48e1293 - releng/14.0 - vfs: retire vnlru_under_unlocked
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 24 Sep 2023 21:46:54 UTC
The branch releng/14.0 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f4f4f48e12931f73565790c54f6ae2d54cf92d35 commit f4f4f48e12931f73565790c54f6ae2d54cf92d35 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-09-14 23:05:51 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2023-09-24 21:45:56 +0000 vfs: retire vnlru_under_unlocked It only looks at the centralized value which in corner cases can end up being negative. Approved by: re (gjb) (cherry picked from commit ba5dc166e0f390c703042910b637a83c705c8af3) (cherry picked from commit b5210f3fb26031e24f2f4c465aa3eab64002353a) --- 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)); }