From nobody Thu Oct 12 07:04:15 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 4S5gc01M3hz4xMl1; Thu, 12 Oct 2023 07:04:16 +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 4S5gc00L7Dz3FMc; Thu, 12 Oct 2023 07:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697094256; 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=NH3SHLKmpU3OS8jz7jaevhiAWd4AzjgRldCvfI2jwh8=; b=diJXggxio3RFMx6h0TuliJD536d7YZL6LXDU7bL+CJoiqmBTffYMRHHHzyaFVU6jdj1Fw1 O5bywWebTulIhfYxXZcNkqJC5vkDlJEKWXaJqusjfVE/A0TSe8OIfCp73zS0jHCEJka0EP W5Fxji1pY3LlZheMOIQ77HKb2FWCFkpL9SFib9Y7cygXp1QUNiPiZseBIvJI2GeFbsOiJS n0nXpLj820nqwGsQYVO4e8XdeHfz++19VQycWHt4cT5p0pZeB5MnmzZdiek/p+qTZ7XKn7 Vd+XSP/UPBXxJBCaG8MAnD5pcI14UdqwwgTXimJ97srBwCCnV3q+6jpzq+rI0Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697094256; a=rsa-sha256; cv=none; b=Y+I4D5TjMpJ2AYuRFUHE2jdD6gxz8gsaBjGXPATiWBCyuzZFvqucmLs9W2/wyUjF3K04O4 jfNiJzxj/TarIc+x8hsxB+ehcIPiMyievxf2wyn3JtrQ8qK5ZXYfwJ8TAimAZw2e/DuH20 6fcsvpNRK3zWQvj9AYvYMEiGmi3QkgJHtevdnHJR8TR5w+tIjBYiNgXvMTLM3VSClImYMg ptGzc2HrE0zYsXDYNnHNOF64IogRJXWnbJdXs4BGy5jgnbsDME9TvQ6TycZ9K9uphZUSJa azbYQfNDvFvUmgTo7Y/l2uklM4p0vrdvhdxPX9XIOtbYIJcTNd8zaQTud8v2SQ== 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=1697094256; 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=NH3SHLKmpU3OS8jz7jaevhiAWd4AzjgRldCvfI2jwh8=; b=bQeZgwrn6Kw/pMoAq30odW+WJIxIOiyHKoAfYj5McoCW8Mivu2eZOST6KHtaUGyEmuKG7m K34SRlZh8KPJT5LYJAfcmdfqIC/IeXJdqABXFsa9dHB4kP+vw9NxedLVeUkFrLZHjueDEz Gv/CAUVuQVyV64EhtMpNjoXn9rC3n2BzMu+hObgmXH9/I88eMTDhnpMR4BHaZp1sxRTXh7 l4xbbAT4YSEe4OCmG5WbyJbriRXcn4Qs/DWqvsnuLrT63ZJn7lQjYqXRK/1EQQ8mfTbRJc yMN/Z5Jvay7FBUOp9A37lwPC+pSVuLOBdqh/D9xQGUJNwx0Cp9ccPWWwan2ZtA== 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 4S5gbz6TrhzvCH; Thu, 12 Oct 2023 07:04:15 +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 39C74FRS058300; Thu, 12 Oct 2023 07:04:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39C74FbP058297; Thu, 12 Oct 2023 07:04:15 GMT (envelope-from git) Date: Thu, 12 Oct 2023 07:04:15 GMT Message-Id: <202310120704.39C74FbP058297@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: 37544d976811 - main - vfs: convert recycles_count and recycles_free_count to mere u_long 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: 37544d9768110fd67527db7f2a3f7bb6fc977582 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=37544d9768110fd67527db7f2a3f7bb6fc977582 commit 37544d9768110fd67527db7f2a3f7bb6fc977582 Author: Mateusz Guzik AuthorDate: 2023-10-12 06:57:59 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-12 07:00:15 +0000 vfs: convert recycles_count and recycles_free_count to mere u_long Only vnlru ever updates them. This also removes recycles_count updates from hand-rolled debug vnode recycling via sysctl. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/kern/vfs_subr.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index b14793ccd84e..0fe2bc46446c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -199,16 +199,19 @@ static long wantfreevnodes; static long __exclusive_cache_line freevnodes; static long freevnodes_old; -static counter_u64_t recycles_count; -SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, +static u_long recycles_count; +SYSCTL_ULONG(_vfs, OID_AUTO, recycles, CTLFLAG_RD | CTLFLAG_STATS, &recycles_count, 0, "Number of vnodes recycled to meet vnode cache targets (legacy)"); -SYSCTL_COUNTER_U64(_vfs_vnode_vnlru, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, +SYSCTL_ULONG(_vfs_vnode_vnlru, OID_AUTO, recycles, CTLFLAG_RD | CTLFLAG_STATS, + &recycles_count, 0, "Number of vnodes recycled to meet vnode cache targets"); -static counter_u64_t recycles_free_count; -SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles_free, CTLFLAG_RD, &recycles_free_count, +static u_long recycles_free_count; +SYSCTL_ULONG(_vfs, OID_AUTO, recycles_free, CTLFLAG_RD | CTLFLAG_STATS, + &recycles_free_count, 0, "Number of free vnodes recycled to meet vnode cache targets (legacy)"); -SYSCTL_COUNTER_U64(_vfs_vnode_vnlru, OID_AUTO, recycles_free, CTLFLAG_RD, &recycles_free_count, +SYSCTL_ULONG(_vfs_vnode_vnlru, OID_AUTO, recycles_free, CTLFLAG_RD | CTLFLAG_STATS, + &recycles_free_count, 0, "Number of free vnodes recycled to meet vnode cache targets"); static counter_u64_t direct_recycles_free_count; @@ -458,7 +461,6 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS) goto putvnode; } - counter_u64_add(recycles_count, 1); vgone(vp); putvnode: vput(vp); @@ -492,7 +494,6 @@ sysctl_ftry_reclaim_vnode(SYSCTL_HANDLER_ARGS) if (error != 0) goto drop; - counter_u64_add(recycles_count, 1); vgone(vp); VOP_UNLOCK(vp); drop: @@ -774,8 +775,6 @@ vntblinit(void *dummy __unused) uma_prealloc(buf_trie_zone, nbuf); vnodes_created = counter_u64_alloc(M_WAITOK); - recycles_count = counter_u64_alloc(M_WAITOK); - recycles_free_count = counter_u64_alloc(M_WAITOK); direct_recycles_free_count = counter_u64_alloc(M_WAITOK); vnode_skipped_requeues = counter_u64_alloc(M_WAITOK); @@ -1282,7 +1281,7 @@ restart: vn_finished_write(mp); goto next_iter_unlocked; } - counter_u64_add(recycles_count, 1); + recycles_count++; vgonel(vp); VOP_UNLOCK(vp); vdropl_recycle(vp); @@ -1911,7 +1910,7 @@ vtryrecycle(struct vnode *vp, bool isvnlru) } if (!VN_IS_DOOMED(vp)) { if (isvnlru) - counter_u64_add(recycles_free_count, 1); + recycles_free_count++; else counter_u64_add(direct_recycles_free_count, 1); vgonel(vp);