From nobody Tue Oct 10 16:29:48 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 4S4hFT244Sz4x0Sb; Tue, 10 Oct 2023 16:29:49 +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 4S4hFT1Yttz4b1J; Tue, 10 Oct 2023 16:29:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696955389; 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=dywCj19dBBK/HIlYaXsQJlekn9GFLmqFm1xVRG3FTWA=; b=AogF22tncuWJ3LtuVmihrqRRcqTFzj5m1eO7NVyq4jb4aPlniRgqj29I0UjK2hvmP5N+3c 0+3KQBFm50ikUfA9RZwuDrbZVfZQJdSWPPDUvFLv1cnkmJjvJrbtRapQOM3JgAgg7JX6KO 7vflZ8l1aBrfQ9BqC41/eMnvoe/5s65XdKrGJ89qqVtTUMUJ95S118woWpQ7NctQ7EaRpP ACgAV5dIDrr02fWobirC+HPz4lA08yaK0xEY8IA5dCfxHKaHex2OOSUUYRL2SNRn01HURP 4llrV8olF5JPLi+XQTEQGatt1/wGnFUXDWidncH8jZ97fMLvcs/6rYn5YYfvFQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696955389; a=rsa-sha256; cv=none; b=ZHIueEyQT2p2Q0BDdiVt9zaKjC/AjiyeRK5G8ArOLckCpbJYG/hrCTBwpGmkvVCBl8mWPp wZ8sw/ICt3bFt80c+rTya5mYLDhoexNwAwGQIjT0RTmzrmgAKm7cVrQhiHXnl0aZAiRL0f vbKGM/zn2l6jxzVZLa4CpIiYkN0nVPceWzSfxMfiy1vbkuIATpYj38LSNQjiRu7geaf/1m Dr0JN6XsudCg1TxURM9rsbj1bZKLwCdAFuU82wP8w39fpFt+U8EQ4bIcfR/6lETgbhgsij Nw4d0aHex1WP50P6jHuSkc3hftyN1YZdmDsGVwVuie5W/pVqxVQospx5EWoNfg== 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=1696955389; 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=dywCj19dBBK/HIlYaXsQJlekn9GFLmqFm1xVRG3FTWA=; b=mpECtYr6skJ2RW5MVg9cZTT7Urf0fJdG7YuW5GZPZzlCvwvlwea090NrCQK/k61HSrs2Qo /uFlB48vVsmscbmV+Jbny33nmwP22lZxl7kxSSptdWwWRWq8n7Lww0Lrnb8ZfGoDQ+njz0 eKMhotOJ8cQl17Y/dkGI+zLrU7D/ZDIKxd7saCRaaGlDN6k+Wn7b1OByoM59XRjyJ2T5dG 6uNlP5aYS8ifkrOL+4KlVvhWZMyV0qBgUtsrE6OPIzVkRmzEf8UuuWYIhHtBX8WI+SDTpG AgeNd7RjI3qAC1nTp8IZLsRmyPTQQnl4HMbp1Cdb7+/wPmyBw/xzm8fOP/cSYg== 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 4S4hFT0cRXzlPG; Tue, 10 Oct 2023 16:29:49 +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 39AGTmNC088265; Tue, 10 Oct 2023 16:29:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39AGTmDa088262; Tue, 10 Oct 2023 16:29:48 GMT (envelope-from git) Date: Tue, 10 Oct 2023 16:29:48 GMT Message-Id: <202310101629.39AGTmDa088262@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: 1bf55a739e75 - main - vfs: be less eager to call uma_reclaim(UMA_RECLAIM_DRAIN) 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: 1bf55a739e754765fa2dc15ab6481fe411084be3 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=1bf55a739e754765fa2dc15ab6481fe411084be3 commit 1bf55a739e754765fa2dc15ab6481fe411084be3 Author: Mateusz Guzik AuthorDate: 2023-10-10 16:15:53 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-10 16:15:53 +0000 vfs: be less eager to call uma_reclaim(UMA_RECLAIM_DRAIN) In face of vnode shortage the count very easily can go few units above the limit before going back down. Calling uma_reclaim results in massive amount of work which in this case is not warranted. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/kern/vfs_subr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index e37f8697efa2..e7e612254ba2 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1674,7 +1674,12 @@ vnlru_proc(void) target = target / 10 + 1; done = vlrureclaim(reclaim_nc_src, trigger, target); mtx_unlock(&vnode_list_mtx); - if (onumvnodes > desiredvnodes && numvnodes <= desiredvnodes) + /* + * Total number of vnodes can transiently go slightly above the + * limit (see vn_alloc_hard), no need to call uma_reclaim if + * this happens. + */ + if (onumvnodes + 1000 > desiredvnodes && numvnodes <= desiredvnodes) uma_reclaim(UMA_RECLAIM_DRAIN); if (done == 0) { if (force == 0 || force == 1) {