git: 84e1b8b965c2 - stable/13 - vfs: flip deferred_inact to atomic
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Aug 2023 22:55:19 UTC
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=84e1b8b965c28e4ea68d033c3c6b3f397d47cf1f commit 84e1b8b965c28e4ea68d033c3c6b3f397d47cf1f Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-03-25 13:31:17 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2023-08-25 22:52:50 +0000 vfs: flip deferred_inact to atomic Turns out it is very rarely triggered, making a per-cpu counter a waste. Examples from real life boxes: uptime counter 135 days 847 138 days 2190 141 days 1 (cherry picked from commit 245767c2782ef2e29340be0a6755be817f16bad4) --- sys/kern/vfs_subr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 6befc5eead0e..57e619abaa15 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -195,9 +195,9 @@ static counter_u64_t recycles_free_count; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles_free, CTLFLAG_RD, &recycles_free_count, "Number of free vnodes recycled to meet vnode cache targets"); -static counter_u64_t deferred_inact; -SYSCTL_COUNTER_U64(_vfs, OID_AUTO, deferred_inact, CTLFLAG_RD, &deferred_inact, - "Number of times inactive processing was deferred"); +static u_long deferred_inact; +SYSCTL_ULONG(_vfs, OID_AUTO, deferred_inact, CTLFLAG_RD, + &deferred_inact, 0, "Number of times inactive processing was deferred"); /* To keep more than one thread at a time from running vfs_getnewfsid */ static struct mtx mntid_mtx; @@ -724,7 +724,6 @@ vntblinit(void *dummy __unused) vnodes_created = counter_u64_alloc(M_WAITOK); recycles_count = counter_u64_alloc(M_WAITOK); recycles_free_count = counter_u64_alloc(M_WAITOK); - deferred_inact = counter_u64_alloc(M_WAITOK); /* * Initialize the filesystem syncer. @@ -3218,7 +3217,7 @@ vdefer_inactive(struct vnode *vp) vlazy(vp); vp->v_iflag |= VI_DEFINACT; VI_UNLOCK(vp); - counter_u64_add(deferred_inact, 1); + atomic_add_long(&deferred_inact, 1); } static void