git: 245767c2782e - main - vfs: flip deferred_inact to atomic
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 25 Mar 2023 13:42:33 UTC
The branch main has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=245767c2782ef2e29340be0a6755be817f16bad4
commit 245767c2782ef2e29340be0a6755be817f16bad4
Author: Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-03-25 13:31:17 +0000
Commit: Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-03-25 13:42:27 +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
---
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 f8a871906e0f..72be478e310d 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -198,9 +198,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;
@@ -734,7 +734,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.
@@ -3211,7 +3210,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