From nobody Thu Sep 14 23:07:04 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 4RmtHr3Sgjz4strd; Thu, 14 Sep 2023 23:07:04 +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 4RmtHr31Vyz3VBZ; Thu, 14 Sep 2023 23:07:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694732824; 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=C4Rr1ZDEx/Zv8PGm7NqSsPPGk/svejfhh6SFaxkOdhg=; b=mOU/g7AZNZVJasV5IM5FJh1JIFSsE3kDdefKPV2ZW4CfJyf3kFTeL8MCORWJHNIM+dRFci ZWlEbOiCu6FLg9wR9SPAuIMEA1hQGDFcAB3j8xVUs+omqe1JMrNYWDE1FtSlp7RtGZW/1E jG4a9WGlTEiHv8gtAOb7P8CgCMT0bQY5UbDNVRGIJBC5J2kAjReFDbpxBz6SS/pKiJYfVA QwI4JI3jtjcu7j3Pc0BsD+t1Wtxre1QYrtbTSEtQLhCtOQ8v3dZ0X1GAKqc/CzGtgL75U9 2uOxBRS14NSIpJHJyDJOCEwLpfpMW3XBvF0saQ5M1bo7Jrk9oj3BVyZ5pD+hTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694732824; a=rsa-sha256; cv=none; b=FlH9QD4m8cSkJ7PBqvMnxCzuB2kJ9nKLJBpK5g9icpM2a7TVfpKHeqm3tUg4JWpd4G13B1 kFHU/As4ET5ZcXKHm8jyRJaN3aaCzttoQNOVds0/4mGQxMo4cKzSryg6hPowMq6igXQsHo csx7W0BnXVTEwuEAhGGM09TN3B4If6ZoqPhcr/5iVyhETqRI2uKUmv2qpjbUwTxMTHDke/ xF0Ao9I8QBcwIy3FZOBE66WH2AaW/kXP3PR1oaoqsn9jfg9krFj8/Adq6ZetFmSc6nOfyx QryZCAyODtOfGfZAkgEZY/78roqwlJc0T9r+T4mARbrRw8GGk/baADTCGhRn5g== 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=1694732824; 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=C4Rr1ZDEx/Zv8PGm7NqSsPPGk/svejfhh6SFaxkOdhg=; b=H5xKEVQuU6+Ko0r94avzzdl9xxjYAskpZpSveiXESMX50szoKVGGEm+RDgmEofegWl2IjG R1bmy5IYb28KyBog9SV/2JRVOUSzbURNtYQYKBTLCm9HfmJ3139yFsnfJHeOnql4PoIMaJ dyyqaJquUN4U5OVENL2ATEdakDCOGjQk1Tx/r+6+mnoUtJqduFJaQ2Xr2NS0m4gh+aqY/W 9BrwACzgSTt/O6b6LjwD1NXkh2AkmeeCKD4Ef6xbPcXYEhG8fSAHhgtbHhaSDyRkK5aKh1 ckj3XzFQpdfcFfySKxQykUZMrOdlzGNWLqRQ7ctwjK3ewFv148k3KWqvWQf5Qw== 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 4RmtHr26Rbz1FDD; Thu, 14 Sep 2023 23:07:04 +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 38EN74uH094751; Thu, 14 Sep 2023 23:07:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38EN74N3094748; Thu, 14 Sep 2023 23:07:04 GMT (envelope-from git) Date: Thu, 14 Sep 2023 23:07:04 GMT Message-Id: <202309142307.38EN74N3094748@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: ba5dc166e0f3 - main - vfs: retire vnlru_under_unlocked 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: ba5dc166e0f390c703042910b637a83c705c8af3 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ba5dc166e0f390c703042910b637a83c705c8af3 commit ba5dc166e0f390c703042910b637a83c705c8af3 Author: Mateusz Guzik AuthorDate: 2023-09-14 23:05:51 +0000 Commit: Mateusz Guzik CommitDate: 2023-09-14 23:05:51 +0000 vfs: retire vnlru_under_unlocked It only looks at the centralized value which in corner cases can end up being negative. --- 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)); }