aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2023-10-10 16:15:53 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2023-10-13 23:41:46 +0000
commit9ff38b3d881ce910803500fe3460f8283c96b4b2 (patch)
tree04edde3210922918c7326f253d1abd7508afae2d
parent71a06765dc67090735293027136c8a0b5fc8c173 (diff)
downloadsrc-9ff38b3d881ce910803500fe3460f8283c96b4b2.tar.gz
src-9ff38b3d881ce910803500fe3460f8283c96b4b2.zip
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") (cherry picked from commit 1bf55a739e754765fa2dc15ab6481fe411084be3)
-rw-r--r--sys/kern/vfs_subr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index e37f8697efa2..e7e612254ba2 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -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) {