aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2023-10-11 06:39:48 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2023-10-11 06:39:48 +0000
commita4f753e812d8913e9be481c6dfa1574c7f032a56 (patch)
treef788f19bff283390b0e3940fe5f2c92a11829456 /sys/kern/vfs_subr.c
parenta572dfa1bfe00cec93b27d8848ca49562cab5e3c (diff)
downloadsrc-a4f753e812d8913e9be481c6dfa1574c7f032a56.tar.gz
src-a4f753e812d8913e9be481c6dfa1574c7f032a56.zip
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 5834feff080c..52c14b4a234a 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -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);
@@ -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);