From nobody Fri Sep 22 21:51:18 2023 X-Original-To: dev-commits-src-all@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 4RsmDl1dCFz4tTMZ; Fri, 22 Sep 2023 21:51:19 +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 4RsmDl0jP8z3Ps0; Fri, 22 Sep 2023 21:51:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695419479; 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=Xm2Q4alr8IsorKZ9QEKyw4zoujUPL+n4/SDRZoOaLow=; b=EHfetrliadDo/lfSk8mmzh+o08/G/76OhKzAh1cTYQESCIpfYsndeCIDEOYfLPHU8qUUlo zZcHERgT9hujXcgp47+k81CS5hCjWTKiGIEGRfzFF9xHOvsnFGh4O46JU47smyEjrz1OvN MWBxsFz0JTyAcpGM3ugMRfDMgYAw/jREqAZJvfJx1GKSiUadTZr0R3aoHVSq1tXy/1U33G 4Pgafiu9KU81/tu1ICG/t4sri7MbCbgf45NRfgcmWEXEWb/+RSMU8gVVgtubclLOxNCpEo KXCshVmE85Dv+f+1ufT6qHsiCmc9UToMagOpmQBsUFaSCNTdYhYs9iLBndLLvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695419479; a=rsa-sha256; cv=none; b=COLRpZp4m81OWOZQHbtv2Ig3SEkyP+hbrdvQYpI1IocKrVQge0OcZODBNBVIAgCg2T54EY YKcpiGpvGCC1aZgFbWkGAd+fYfyQjrUqZHofN4Asma2hWS7PRNhONKZkz9b8U/7zkkqJDD w0vhB91cWqaOMk1itj1vQBhC6yLzsSvqf6acCEFHtTVaqAIv8Yed8g/v2LMd9F7K0QZcmq /8h5eDYd7Yokql7E1+gmj70TWiFVpubHNNgzxKim1G3MZQ8KMhPhuca//sTSOL8j8boBUx 3wiEc/A10Na3BJ0jUzX8NTeUUDDbtWRF7MrI32cRf5kDiaUA5xzvmJaheHGFdQ== 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=1695419479; 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=Xm2Q4alr8IsorKZ9QEKyw4zoujUPL+n4/SDRZoOaLow=; b=Hev7mTW72CFMNqsA6t6aprservgM3CnIhPWD3RQuCt47kGVg2o+TmgMPa3X/7sld11ITk7 bbJUKXpqoiwfck94nG7uiTDpRgWTgZmJn5opHysTYuMoLp3Kv6JmwkXizgbg7xCdKHyE7V Q/IKBY0gzdsU5L85MVPesca/04C+AwVdVjUzHGZefMxWKEcQZz8w/S5o2rlpr38bHQVHgD Mudx1enSg+o0HYzosZ8kh1Fpf44eZfxsgAisFqzEsKT8HkMhIPDG8WuL1fsoHnWdUgNTqA ZgJO9mKqxI9aEQ0bMRWSli5j9fNuMK8u7M8ogwAuTrWN24z4ymNU7FwTc3j3rg== 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 4RsmDk6wCCzdvL; Fri, 22 Sep 2023 21:51:18 +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 38MLpIjZ039395; Fri, 22 Sep 2023 21:51:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38MLpIFU039392; Fri, 22 Sep 2023 21:51:18 GMT (envelope-from git) Date: Fri, 22 Sep 2023 21:51:18 GMT Message-Id: <202309222151.38MLpIFU039392@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: b5210f3fb260 - stable/14 - vfs: retire vnlru_under_unlocked List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: b5210f3fb26031e24f2f4c465aa3eab64002353a Auto-Submitted: auto-generated The branch stable/14 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b5210f3fb26031e24f2f4c465aa3eab64002353a commit b5210f3fb26031e24f2f4c465aa3eab64002353a Author: Mateusz Guzik AuthorDate: 2023-09-14 23:05:51 +0000 Commit: Mateusz Guzik CommitDate: 2023-09-22 21:50:47 +0000 vfs: retire vnlru_under_unlocked It only looks at the centralized value which in corner cases can end up being negative. (cherry picked from commit ba5dc166e0f390c703042910b637a83c705c8af3) --- sys/kern/vfs_subr.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index ed478d33aed0..84219f3b5c12 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1528,23 +1528,6 @@ vnlru_under(u_long rnumvnodes, u_long limit) return (space < limit); } -static bool -vnlru_under_unlocked(u_long rnumvnodes, u_long limit) -{ - long rfreevnodes, space; - - if (__predict_false(rnumvnodes > desiredvnodes)) - return (true); - - space = desiredvnodes - rnumvnodes; - if (space < limit) { - rfreevnodes = atomic_load_long(&freevnodes); - if (rfreevnodes > wantfreevnodes) - space += rfreevnodes - wantfreevnodes; - } - return (space < limit); -} - static void vnlru_kick_locked(void) { @@ -1826,7 +1809,7 @@ vn_alloc(struct mount *mp) if (__predict_false(vn_alloc_cyclecount != 0)) return (vn_alloc_hard(mp)); rnumvnodes = atomic_fetchadd_long(&numvnodes, 1) + 1; - if (__predict_false(vnlru_under_unlocked(rnumvnodes, vlowat))) { + if (__predict_false(vnlru_under(rnumvnodes, vlowat))) { atomic_subtract_long(&numvnodes, 1); return (vn_alloc_hard(mp)); }