Skip to content

Commit

Permalink
vfs: don't recycle transiently excess vnodes
Browse files Browse the repository at this point in the history
Sponsored by:	Rubicon Communications, LLC ("Netgate")
  • Loading branch information
mjguzik committed Oct 11, 2023
1 parent a572dfa commit a4f753e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sys/kern/vfs_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1656,8 +1656,12 @@ vnlru_proc_light_pick(void)
/*
* vnode limit might have changed and now we may be at a significant
* excess. Bail if we can't sort it out with free vnodes.
*
* Due to atomic updates the count can legitimately go above
* the limit for a short period, don't bother doing anything in
* that case.
*/
if (rnumvnodes > desiredvnodes) {
if (rnumvnodes > desiredvnodes + 10) {
if (rnumvnodes - rfreevnodes >= desiredvnodes ||
rfreevnodes <= wantfreevnodes) {
return (-1);
Expand Down Expand Up @@ -1734,7 +1738,7 @@ vnlru_proc(void)
* adjusted using its sysctl, or emergency growth), first
* try to reduce it by discarding from the free list.
*/
if (rnumvnodes > desiredvnodes) {
if (rnumvnodes > desiredvnodes + 10) {
vnlru_free_locked(rnumvnodes - desiredvnodes);
mtx_lock(&vnode_list_mtx);
rnumvnodes = atomic_load_long(&numvnodes);
Expand Down

0 comments on commit a4f753e

Please sign in to comment.