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)
This commit is contained in:
Mateusz Guzik 2023-09-14 16:13:01 +00:00
parent b627b3e6ea
commit 8733bc277a

View file

@ -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