vfs: be less eager to call uma_reclaim(UMA_RECLAIM_DRAIN)

In face of vnode shortage the count very easily can go few units above
the limit before going back down.

Calling uma_reclaim results in massive amount of work which in this case
is not warranted.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
Mateusz Guzik
2023-10-10 16:15:53 +00:00
parent e49c7cd677
commit 1bf55a739e
+6 -1
View File
@@ -1674,7 +1674,12 @@ vnlru_proc(void)
target = target / 10 + 1;
done = vlrureclaim(reclaim_nc_src, trigger, target);
mtx_unlock(&vnode_list_mtx);
if (onumvnodes > desiredvnodes && numvnodes <= desiredvnodes)
/*
* Total number of vnodes can transiently go slightly above the
* limit (see vn_alloc_hard), no need to call uma_reclaim if
* this happens.
*/
if (onumvnodes + 1000 > desiredvnodes && numvnodes <= desiredvnodes)
uma_reclaim(UMA_RECLAIM_DRAIN);
if (done == 0) {
if (force == 0 || force == 1) {