From nobody Wed Oct 04 12:08:52 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 4S0tl873Wkz4vnyh; Wed, 4 Oct 2023 12:08:52 +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 4S0tl86Fnhz3Hvb; Wed, 4 Oct 2023 12:08:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696421332; 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=ebp/+qN2Jxf3oblh2sgqfXCthVGfQ/HQkPsnuXrplsM=; b=M7hc1FJaHmNM5HmT5/5rnuXx2x1/gEC1V8N3NtI0iLlKgOOWe/qLQDubargmW9zRImQXar JMvrkRvpj5Dh/7GbgTzHbs7Htdbm6jLWdiuffjq4s7+JS19KcwfmzXw2sAs3rK/OMa/uPu rWQJc/boSXUUKHOLSnqZ6TH0YGs6HvFOFSSq7wFjOeS+03vz7hkMDPoKI9+mg3RNHRh9rE J7f0GOpo2RmaVDIe9YDGgFfVQ7J7+v5I+OtU0+fOuOiLt5l4PPjwOf3QyKP2FyWK9Zo9l7 Dl580GQZQhBFAaWnwIVfT7MqgyjdF4JRBU7yDkbwns1wGLSFMIY+XHTia1gNVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696421332; a=rsa-sha256; cv=none; b=RV0F3QBSO+ZyJo59ieAr4Pyyznqppq/s/sDNbQl7bdpo0Vavx+zW1q3ApHdB2PuncJbJcL ckGZSWK6xrmIr8y0fg4HWA1ftu96jx8kDNNIJ7qguHyXL7VWzesI4kxSWgHy1aCc/JwOzo Q70H/PUWKCklw3EfVwPEKjdpI2fLb7lNO3Cw47xIBlOfRHtBt13F/teV4UF6recUS+OIXf BRrZ8XlADu/jOs994/lFudtu2Nc+A5wK9e6uXTpf37Z0i/i7cQmxpQ+uSlsuktHp/Q93Ep IDt7UbPoufHPDFK0m2mOsCrXUWf6SGBtnsT223JUSYgco23Gu+2WuD/u0EItqA== 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=1696421332; 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=ebp/+qN2Jxf3oblh2sgqfXCthVGfQ/HQkPsnuXrplsM=; b=IBj48nPcYVsneAqs1oHMyJm5uaKgPajuWBUjwiYACCrcxzAaspD0jOrE+bjRkLd/V4xs60 zP213EJgkrFaOtod+VFoAOGQ2M1u8pJEycTZz/P3H65RMlhpxH0lA1Gpy9jim45IxFh7N8 Rhr/qjYPKC4lwAJ6Akydlp2y1WrDgCriuXSgc1A7SNNro5pUOFTPZLkmOzk8MfMzXxnB7a eJ7wQDdpuSQLMpUDpQwbAnNkomRpI1UBymQan5Cba0PTqiJa11L5kUgbGbK1UlqRwNTA0P JF3OBpEzLOXGKXIf5qRP4S3cE+kyM/uXj5tykwRLmlf6K9Xhul06kL0K6E4Pvg== 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 4S0tl85Lw7zcgT; Wed, 4 Oct 2023 12:08:52 +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 394C8q5W053272; Wed, 4 Oct 2023 12:08:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394C8qhN053269; Wed, 4 Oct 2023 12:08:52 GMT (envelope-from git) Date: Wed, 4 Oct 2023 12:08:52 GMT Message-Id: <202310041208.394C8qhN053269@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: 1573dad63632 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 1573dad63632b2545516e3aa9b5bfc9a0f06281a Auto-Submitted: auto-generated The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=1573dad63632b2545516e3aa9b5bfc9a0f06281a commit 1573dad63632b2545516e3aa9b5bfc9a0f06281a Author: Mateusz Guzik AuthorDate: 2023-09-14 23:05:51 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-04 12:04:16 +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 41fd5052968c..04bc26014db7 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1543,23 +1543,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) { @@ -1842,7 +1825,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)); }