From nobody Tue Oct 10 12:52:34 2023 X-Original-To: dev-commits-src-main@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 4S4bQp2ShHz4wjv8; Tue, 10 Oct 2023 12:52:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S4bQp20jFz4F4L; Tue, 10 Oct 2023 12:52:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696942354; 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=0lnc5daSe1oZ2tvTwXIQcvI4qyylavmUkvlcIFvB9Vk=; b=L150zdvz8HOk7Y2KV7e1uccSNlt1SwPw9QQiVU3GtYWE9gsdnbrp4YzGQFMIZNv7SXztcM jTSWD7yfKJ4JkbNrNJGWzYRahOYb/gxMpgkkbIUAmWJppHzT7PLF27riHjTG2LlDJi+DOg +DHnMzDTTOTJS6vMA9vlicJnCGKQju7hoWeNCcscaEK2lM4jhGylXdOR9VOXs1B/NlKepw d/jugtPOvRHtZZTkDH9WIVehLBlgHIYG5LFx5Rxru8DOpxmIfgYY3nEatPl4cXf5o6w1Ui PQPXvqPewJwiZRknqS+DFaBvh424Chw9X1JXK7Mnkri/SAJI+JPgfP/YNIlHhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696942354; a=rsa-sha256; cv=none; b=H0budCoJFlXxruotIkdpVtCol0EiAK1juG5Og9cB61V7FP1tkBASRT77N0gHrZjND4GiTE k0pzUi3C+14zRLjIc7K6nAO9kXxqxVD8wm8Vl0kc10KlJpPmQjWEdJzYwbgcVwrJGBvzT4 CI7Xz6tsaOMJY+Q2t+VQsferNHVTiZ5A2VW8e7kEnqze68DAr2OfNqNGnbmALRPsZh2kTH ZpFkkAxQ2z8MQrqYcoG8cEoSQEJlWJs9p3y6CP0C4eOrGQBryK/jXRiuy8FEP5hhM5X8KA O3ZAJrUF2/Q22qG3QEar0QyUIG7ffUtYMErDngrjKr6oeo5jC4JP+gjmoAenMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696942354; 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=0lnc5daSe1oZ2tvTwXIQcvI4qyylavmUkvlcIFvB9Vk=; b=yuTSHIjqOXTU6AvS4a8oSUqTb7fQtmBTKzWovq+tliBM0m91zS2cOKGKuUabBDX1wtrRp/ wgfHGm9LzkVvU6BvD439jWOyaVrB2EcKRF3i6TyhTW+MIQGR0XvoXhCwAU/V9VrBjkoDO/ pLecQRZAS7zsUIJr2hEK0LIcOOGSLa0h9+iQjgefUqnskUNpbRCaf9PIEz6U0R5daA1Tvh Hc9AkoFkZdq8rqCWuAPzBwHF9AhOGJaqjIFeTgWSSraeVljykxC+1pnLb+NDdKGtPY55AS SUs4/+AIzS8zZtq/1tQlIKvLo2mXfjeBdstQXrtYhrF9NFjva8ugnUHLIC6zrQ== 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 4S4bQp148Mzfgw; Tue, 10 Oct 2023 12:52:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39ACqYK8037417; Tue, 10 Oct 2023 12:52:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39ACqYIx037414; Tue, 10 Oct 2023 12:52:34 GMT (envelope-from git) Date: Tue, 10 Oct 2023 12:52:34 GMT Message-Id: <202310101252.39ACqYIx037414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 8733bc277a38 - main - vfs: don't provoke recycling non-free vnodes without a good reason List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8733bc277a383cf59f38a83956f4f523869cfc90 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8733bc277a383cf59f38a83956f4f523869cfc90 commit 8733bc277a383cf59f38a83956f4f523869cfc90 Author: Mateusz Guzik AuthorDate: 2023-09-14 16:13:01 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-10 12:49:04 +0000 vfs: don't provoke recycling non-free vnodes without a good reason If the total number of free vnodes is at or above target, there is no point creating more of them. Tested by: pho (in a bigger patch) --- sys/kern/vfs_subr.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 0251525a50c7..e37f8697efa2 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1802,11 +1802,19 @@ vn_alloc_hard(struct mount *mp) mtx_unlock(&vnode_list_mtx); goto alloc; } - rfreevnodes = vnlru_read_freevnodes(); - if (vn_alloc_cyclecount++ >= rfreevnodes) { - vn_alloc_cyclecount = 0; - vstir = true; + + if (vn_alloc_cyclecount != 0) { + rfreevnodes = vnlru_read_freevnodes(); + if (rfreevnodes < wantfreevnodes) { + if (vn_alloc_cyclecount++ >= rfreevnodes) { + vn_alloc_cyclecount = 0; + vstir = true; + } + } else { + vn_alloc_cyclecount = 0; + } } + /* * Grow the vnode cache if it will not be above its target max * after growing. Otherwise, if the free list is nonempty, try