From nobody Tue May 20 09:08:40 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4b1pd50rCKz5w54h; Tue, 20 May 2025 09:08:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4b1pd45shdz43Fm; Tue, 20 May 2025 09:08:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747732120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TRpKQkhSSMx0M7cYOtbQE9XBa9jHQjsXjhKwv8ueEv4=; b=CMbdCb8nenVUjoC8YCOC7oyewGbSjZas7DL69IVYsmZL4yT7WF1jIJdx3SoN7bZV/Rb1Iw jPQ8JNg1lOsh4itZ9ZuPt3SUJzqJ3XmizJaDkSFmJTW53CfhT5fk8RZfzDQ2zrEmkVWzx3 saLTYxlqreduhGo/dubNKaxOIFSRjzJzgSQ9ti0TDLj+jPwDTBejluA+s4gvQbIAOGln7O MqeHcwNGz8w7QhR2Flh9HO3431CWN2AhDwTsz3p/a3ZOVF2pYAkVVMX22igDx+8zG2ow12 XY/0GW9uLTqikuOeeph8xwFG7yyM9p5ZVTk+apHvYbnySVFriKmJsA0KkS8mjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747732120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TRpKQkhSSMx0M7cYOtbQE9XBa9jHQjsXjhKwv8ueEv4=; b=K0pEftR7J5cdBJIragvboCXq8GDeSThFjoj2+U4ZfPNo+eNWSzmMLWvtbmFN5Q3ZYWXWYb rrd1MyIGX0gUBMNBXjgSVX6yGaNItBWyTdVSGIp15VV2wFHjTEpKQJxqsjQ4BijSWPAfsb aL7apvZRi+eqJONi69k7qQvj6zazIEUlrBzQ3+bsbD5rukAfa9S1W+OVSPLVsyVTgvu+uo D2/6dFMqS+BD2uGU/KyJUMWm895MHiXazz/j7IXi+j/7HkzonDwgvjHjckjAvg9HnppAXy Tav1Z2PxkFRQWT0ltNTYGqkidcVAPv/jfvLCBTijmpj6d8o6PjoxZchRyfcvlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1747732120; a=rsa-sha256; cv=none; b=bFiNIRaXDp6UJ5ixtNJ57e12ihb2qQEAVsgx0C7nj6eIU2ZVUMM1kYLtEDAntd+zeJjH1f fqkuZPQsjplJbWXjpHMkpiEGoh76K4PxTcxFcmBHurvDlHozjSv9QJt0hyXPXROrnN8nJ7 HaLz1ReemcoSDQNkTJGgQiyK7djnxCIla8GVqumH0JC20WIombD2pPqJZhujXwdikSFfEx KfAlidq+hhuA4F1wmOrPIw7OECFureWd/spBbboygJYGxlEIavb1n0UnmvhHmP0JRe0FjT HeiDDJBmtChSGxCTKJ/iDwuhvoRY5TaZi2UWfHgW0jG20k9EToz3SFHls/JuFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4b1pd453cpzkHZ; Tue, 20 May 2025 09:08:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 54K98eVS000887; Tue, 20 May 2025 09:08:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 54K98eXU000883; Tue, 20 May 2025 09:08:40 GMT (envelope-from git) Date: Tue, 20 May 2025 09:08:40 GMT Message-Id: <202505200908.54K98eXU000883@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: a6b05a35ce3c - stable/14 - vfs: vntblinit(): Raise default 'kern.maxvnodes' higher than 'kern.maxfiles' List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a6b05a35ce3c516cadfca49c310dffaabbe40440 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=a6b05a35ce3c516cadfca49c310dffaabbe40440 commit a6b05a35ce3c516cadfca49c310dffaabbe40440 Author: Olivier Certner AuthorDate: 2025-05-12 12:19:56 +0000 Commit: Olivier Certner CommitDate: 2025-05-20 09:05:33 +0000 vfs: vntblinit(): Raise default 'kern.maxvnodes' higher than 'kern.maxfiles' Having 'kern.maxvnodes' higher than 'kern.maxfiles' mitigates a scenario where some processes can eat up all vnodes in the system, causing a deadlock, as long as the kernel itself does not create too many vnodes without creating some file descriptor in some process' FD table. A very small percentage (~0.6%) of excess vnodes at infinity, coupled with a large difference near the origin, should cover basic cases more than enough. Note however that this measure can be defeated, e.g., by using nullfs mounts with non-trivial file hierarchies. MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50314 (cherry picked from commit e9baf472a6d228a16be19a11150d41cff29affe8) --- sys/kern/vfs_subr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 62ae987a3084..7ff6ac5f5b44 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -727,13 +727,12 @@ vntblinit(void *dummy __unused) * KVA). * * Currently, on 64-bit platforms, 'desiredvnodes' is set to - * 'virtvnodes' up to a physical memory cutoff of ~1674MB, after which + * 'virtvnodes' up to a physical memory cutoff of ~1722MB, after which * 'physvnodes' applies instead. With the current automatic tuning for - * 'maxfiles' (32 files/MB), 'desiredvnodes' becomes smaller than it at - * ~5136MB. + * 'maxfiles' (32 files/MB), 'desiredvnodes' is always greater than it. */ - physvnodes = maxproc + pgtok(vm_cnt.v_page_count) / 64 + - 3 * min(98304 * 16, pgtok(vm_cnt.v_page_count)) / 64; + physvnodes = maxproc + pgtok(vm_cnt.v_page_count) / 32 + + min(98304 * 16, pgtok(vm_cnt.v_page_count)) / 32; virtvnodes = vm_kmem_size / (10 * (sizeof(struct vm_object) + sizeof(struct vnode) + NC_SZ * ncsizefactor + NFS_NCLNODE_SZ)); desiredvnodes = min(physvnodes, virtvnodes);