Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 May 2025 14:28:05 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: bf8890c84bac - main - vfs: vntblinit(): Rework comments on the computation of 'kern.maxvnodes'
Message-ID:  <202505151428.54FES5ov059319@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by olce:

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

commit bf8890c84bacd8b1acebb2cb9a0944b1bb102b68
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-05-12 11:20:01 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-05-15 14:27:42 +0000

    vfs: vntblinit(): Rework comments on the computation of 'kern.maxvnodes'
    
    Remove the parts that describe what is already in the code formula.  Add
    hints about which of 'physvnodes'/'virtvnodes' takes precedence, and
    when 'desiredvnodes' becomes smaller than 'maxfiles'.  These were both
    computed analytically and verified experimentally.
    
    Reviewed by:    kib (older version)
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D50310
---
 sys/kern/vfs_subr.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 5fdd4b6c2474..769586ad0d6b 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -757,15 +757,15 @@ vntblinit(void *dummy __unused)
 	int cpu, physvnodes, virtvnodes;
 
 	/*
-	 * Desiredvnodes is a function of the physical memory size and the
-	 * kernel's heap size.  Generally speaking, it scales with the
-	 * physical memory size.  The ratio of desiredvnodes to the physical
-	 * memory size is 1:16 until desiredvnodes exceeds 98,304.
-	 * Thereafter, the
-	 * marginal ratio of desiredvnodes to the physical memory size is
-	 * 1:64.  However, desiredvnodes is limited by the kernel's heap
-	 * size.  The memory required by desiredvnodes vnodes and vm objects
-	 * must not exceed 1/10th of the kernel's heap size.
+	 * 'desiredvnodes' is the minimum of a function of the physical memory
+	 * size and another of the kernel heap size (UMA limit, a portion of the
+	 * KVA).
+	 *
+	 * Currently, on 64-bit platforms, 'desiredvnodes' is set to
+	 * 'virtvnodes' up to a physical memory cutoff of ~1674MB, after which
+	 * 'physvnodes' applies instead.  With the current automatic tuning for
+	 * 'maxfiles' (32 files/MB), 'desiredvnodes' becomes smaller than it at
+	 * ~5136MB.
 	 */
 	physvnodes = maxproc + pgtok(vm_cnt.v_page_count) / 64 +
 	    3 * min(98304 * 16, pgtok(vm_cnt.v_page_count)) / 64;



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