git: eb58f9e6c6df - stable/13 - vfs: convert recycles_count and recycles_free_count to mere u_long
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Oct 2023 23:54:02 UTC
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=eb58f9e6c6dfbd6a43277bc0253152302ac1c2a2 commit eb58f9e6c6dfbd6a43277bc0253152302ac1c2a2 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-10-12 06:57:59 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2023-10-13 23:52:39 +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") (cherry picked from commit 37544d9768110fd67527db7f2a3f7bb6fc977582) --- 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 530afbe05b3e..3305110ed065 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -198,16 +198,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; @@ -459,7 +462,6 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS) goto putvnode; } - counter_u64_add(recycles_count, 1); vgone(vp); putvnode: NDFREE(&nd, 0); @@ -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: @@ -768,8 +769,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); @@ -1272,7 +1271,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); @@ -1929,7 +1928,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);