Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 2023 23:53:56 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e47ede47277c - stable/13 - vfs: don't recycle transiently excess vnodes
Message-ID:  <202310132353.39DNruhD032319@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=e47ede47277c6e3c8a5a8077200179e4065fe7fc

commit e47ede47277c6e3c8a5a8077200179e4065fe7fc
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-10-11 06:39:48 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-10-13 23:48:13 +0000

    vfs: don't recycle transiently excess vnodes
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit a4f753e812d8913e9be481c6dfa1574c7f032a56)
---
 sys/kern/vfs_subr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index e4b9ff8e1ba6..54796fe6ef7d 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1673,8 +1673,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);
@@ -1751,7 +1755,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202310132353.39DNruhD032319>