Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2009 21:06:43 +0400
From:      pluknet <pluknet@gmail.com>
To:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   nchstats counters bump
Message-ID:  <a31046fc0905271006k14cde45ciaa43f3d5471d13f8@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hello.

With current long type we have abnormal namecache statistics since
type overflow:

189237651 total name lookups
          cache hits (-513% pos + 408% neg) system 25% per-directory
          deletions 12%, falsehits 0%, toolong 0%

Is that possible to commit this, I hope, non-intrusive change (see
attach, not tested)
to tree before 8.x?
It was done in OpenBSD a year ago.

-- 
wbr,
pluknet

[-- Attachment #2 --]
--- sys/sys/namei.h.orig	Wed May 27 20:43:31 2009
+++ sys/sys/namei.h	Wed May 27 20:49:08 2009
@@ -196,14 +196,14 @@
  * Stats on usefulness of namei caches.
  */
 struct nchstats {
-	long	ncs_goodhits;		/* hits that we can really use */
-	long	ncs_neghits;		/* negative hits that we can use */
-	long	ncs_badhits;		/* hits we must drop */
-	long	ncs_falsehits;		/* hits with id mismatch */
-	long	ncs_miss;		/* misses */
-	long	ncs_long;		/* long names that ignore cache */
-	long	ncs_pass2;		/* names found with passes == 2 */
-	long	ncs_2passes;		/* number of times we attempt it */
+	uint64_t	ncs_goodhits;	/* hits that we can really use */
+	uint64_t	ncs_neghits;	/* negative hits that we can use */
+	uint64_t	ncs_badhits;	/* hits we must drop */
+	uint64_t	ncs_falsehits;	/* hits with id mismatch */
+	uint64_t	ncs_miss;	/* misses */
+	uint64_t	ncs_long;	/* long names that ignore cache */
+	uint64_t	ncs_pass2;	/* names found with passes == 2 */
+	uint64_t	ncs_2passes;	/* number of times we attempt it */
 };
 
 extern struct nchstats nchstats;
--- sys/kern/vfs_cache.c.orig	Wed May 27 19:51:38 2009
+++ sys/kern/vfs_cache.c	Wed May 27 19:58:22 2009
@@ -201,7 +201,7 @@
 static u_long numupgrades; STATNODE(CTLFLAG_RD, numupgrades, &numupgrades);
 
 SYSCTL_OPAQUE(_vfs_cache, OID_AUTO, nchstats, CTLFLAG_RD | CTLFLAG_MPSAFE,
-	&nchstats, sizeof(nchstats), "LU", "VFS cache effectiveness statistics");
+	&nchstats, sizeof(nchstats), "Q", "VFS cache effectiveness statistics");
 
 
 
--- usr.bin/vmstat/vmstat.c.orig	Wed May 27 20:02:58 2009
+++ usr.bin/vmstat/vmstat.c	Wed May 27 20:42:37 2009
@@ -864,7 +864,7 @@
 dosum(void)
 {
 	struct nchstats lnchstats;
-	long nchtotal;
+	uint64_t nchtotal;
 
 	fill_vmmeter(&sum);
 	(void)printf("%9u cpu context switches\n", sum.v_swtch);
@@ -918,7 +918,7 @@
 	nchtotal = lnchstats.ncs_goodhits + lnchstats.ncs_neghits +
 	    lnchstats.ncs_badhits + lnchstats.ncs_falsehits +
 	    lnchstats.ncs_miss + lnchstats.ncs_long;
-	(void)printf("%9ld total name lookups\n", nchtotal);
+	(void)printf("%9jd total name lookups\n", nchtotal);
 	(void)printf(
 	    "%9s cache hits (%ld%% pos + %ld%% neg) system %ld%% per-directory\n",
 	    "", PCT(lnchstats.ncs_goodhits, nchtotal),

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a31046fc0905271006k14cde45ciaa43f3d5471d13f8>