git: 3e0c37999a5e - releng/14.0 - vfs: don't provoke recycling non-free vnodes without a good reason
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 14 Oct 2023 01:08:50 UTC
The branch releng/14.0 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3e0c37999a5e6bd10819140e52a481cb798f82d9 commit 3e0c37999a5e6bd10819140e52a481cb798f82d9 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-09-14 16:13:01 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2023-10-14 01:07:07 +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. Tested by: pho (in a bigger patch) (cherry picked from commit 8733bc277a383cf59f38a83956f4f523869cfc90) (cherry picked from commit 71a06765dc67090735293027136c8a0b5fc8c173) Approved by: re (gjb) --- sys/kern/vfs_subr.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 0251525a50c7..e37f8697efa2 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1802,11 +1802,19 @@ vn_alloc_hard(struct mount *mp) mtx_unlock(&vnode_list_mtx); goto alloc; } - rfreevnodes = vnlru_read_freevnodes(); - if (vn_alloc_cyclecount++ >= rfreevnodes) { - vn_alloc_cyclecount = 0; - vstir = true; + + if (vn_alloc_cyclecount != 0) { + rfreevnodes = vnlru_read_freevnodes(); + if (rfreevnodes < wantfreevnodes) { + if (vn_alloc_cyclecount++ >= rfreevnodes) { + vn_alloc_cyclecount = 0; + vstir = true; + } + } else { + vn_alloc_cyclecount = 0; + } } + /* * Grow the vnode cache if it will not be above its target max * after growing. Otherwise, if the free list is nonempty, try