Skip site navigation (1)Skip section navigation (2)
Date:      01 Nov 2000 17:01:07 +0100
From:      arno@heho.snv.jussieu.fr (Arno J. Klaassen)
To:        freebsd-stable@freebsd.org
Subject:   struct nchstat counters
Message-ID:  <wpwven4r7g.fsf@heho.snv.jussieu.fr>

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


Hi,

I applied the following patch to a ``4.2-BETA #2: Wed Nov 1 16:03:55
MET'' system; one of my heavily used SMP-boxes, produced negative
``total name lookups'' counts after 2-3 weeks uptime (and froze shortly
after, though I doubt that's related). This patch should fix this.

Arno

############ cut here ########
Index: sys/sys/namei.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/namei.h,v
retrieving revision 1.29
diff -u -r1.29 namei.h
--- sys/sys/namei.h	2000/01/08 16:20:06	1.29
+++ sys/sys/namei.h	2000/10/25 12:15:36
@@ -183,14 +183,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 */
+	u_long	ncs_goodhits;		/* hits that we can really use */
+	u_long	ncs_neghits;		/* negative hits that we can use */
+	u_long	ncs_badhits;		/* hits we must drop */
+	u_long	ncs_falsehits;		/* hits with id mismatch */
+	u_long	ncs_miss;		/* misses */
+	u_long	ncs_long;		/* long names that ignore cache */
+	u_long	ncs_pass2;		/* names found with passes == 2 */
+	u_long	ncs_2passes;		/* number of times we attempt it */
 };
 
 extern struct nchstats nchstats;
Index: usr.bin/vmstat/vmstat.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/vmstat/vmstat.c,v
retrieving revision 1.38.2.1
diff -u -r1.38.2.1 vmstat.c
--- usr.bin/vmstat/vmstat.c	2000/07/02 10:05:43	1.38.2.1
+++ usr.bin/vmstat/vmstat.c	2000/10/26 11:52:34
@@ -593,51 +593,51 @@
 dosum()
 {
 	struct nchstats nchstats;
-	long nchtotal;
+	u_long nchtotal;
 
 	kread(X_SUM, &sum, sizeof(sum));
-	(void)printf("%9u cpu context switches\n", sum.v_swtch);
-	(void)printf("%9u device interrupts\n", sum.v_intr);
-	(void)printf("%9u software interrupts\n", sum.v_soft);
-	(void)printf("%9u traps\n", sum.v_trap);
-	(void)printf("%9u system calls\n", sum.v_syscall);
-	(void)printf("%9u swap pager pageins\n", sum.v_swapin);
-	(void)printf("%9u swap pager pages paged in\n", sum.v_swappgsin);
-	(void)printf("%9u swap pager pageouts\n", sum.v_swapout);
-	(void)printf("%9u swap pager pages paged out\n", sum.v_swappgsout);
-	(void)printf("%9u vnode pager pageins\n", sum.v_vnodein);
-	(void)printf("%9u vnode pager pages paged in\n", sum.v_vnodepgsin);
-	(void)printf("%9u vnode pager pageouts\n", sum.v_vnodeout);
-	(void)printf("%9u vnode pager pages paged out\n", sum.v_vnodepgsout);
-	(void)printf("%9u page daemon wakeups\n", sum.v_pdwakeups);
-	(void)printf("%9u pages examined by the page daemon\n", sum.v_pdpages);
-	(void)printf("%9u pages reactivated\n", sum.v_reactivated);
-	(void)printf("%9u copy-on-write faults\n", sum.v_cow_faults);
-	(void)printf("%9u copy-on-write optimized faults\n", sum.v_cow_optim);
-	(void)printf("%9u zero fill pages zeroed\n", sum.v_zfod);
-	(void)printf("%9u zero fill pages prezeroed\n", sum.v_ozfod);
-	(void)printf("%9u intransit blocking page faults\n", sum.v_intrans);
-	(void)printf("%9u total VM faults taken\n", sum.v_vm_faults);
-	(void)printf("%9u pages freed\n", sum.v_tfree);
-	(void)printf("%9u pages freed by daemon\n", sum.v_dfree);
-	(void)printf("%9u pages freed by exiting processes\n", sum.v_pfree);
-	(void)printf("%9u pages active\n", sum.v_active_count);
-	(void)printf("%9u pages inactive\n", sum.v_inactive_count);
-	(void)printf("%9u pages in VM cache\n", sum.v_cache_count);
-	(void)printf("%9u pages wired down\n", sum.v_wire_count);
-	(void)printf("%9u pages free\n", sum.v_free_count);
-	(void)printf("%9u bytes per page\n", sum.v_page_size);
+	(void)printf("%13lu cpu context switches\n", sum.v_swtch);
+	(void)printf("%13lu device interrupts\n", sum.v_intr);
+	(void)printf("%13lu software interrupts\n", sum.v_soft);
+	(void)printf("%13lu traps\n", sum.v_trap);
+	(void)printf("%13lu system calls\n", sum.v_syscall);
+	(void)printf("%13lu swap pager pageins\n", sum.v_swapin);
+	(void)printf("%13lu swap pager pages paged in\n", sum.v_swappgsin);
+	(void)printf("%13lu swap pager pageouts\n", sum.v_swapout);
+	(void)printf("%13lu swap pager pages paged out\n", sum.v_swappgsout);
+	(void)printf("%13lu vnode pager pageins\n", sum.v_vnodein);
+	(void)printf("%13lu vnode pager pages paged in\n", sum.v_vnodepgsin);
+	(void)printf("%13lu vnode pager pageouts\n", sum.v_vnodeout);
+	(void)printf("%13lu vnode pager pages paged out\n", sum.v_vnodepgsout);
+	(void)printf("%13lu page daemon wakeups\n", sum.v_pdwakeups);
+	(void)printf("%13lu pages examined by the page daemon\n", sum.v_pdpages);
+	(void)printf("%13lu pages reactivated\n", sum.v_reactivated);
+	(void)printf("%13lu copy-on-write faults\n", sum.v_cow_faults);
+	(void)printf("%13lu copy-on-write optimized faults\n", sum.v_cow_optim);
+	(void)printf("%13lu zero fill pages zeroed\n", sum.v_zfod);
+	(void)printf("%13lu zero fill pages prezeroed\n", sum.v_ozfod);
+	(void)printf("%13lu intransit blocking page faults\n", sum.v_intrans);
+	(void)printf("%13lu total VM faults taken\n", sum.v_vm_faults);
+	(void)printf("%13lu pages freed\n", sum.v_tfree);
+	(void)printf("%13lu pages freed by daemon\n", sum.v_dfree);
+	(void)printf("%13lu pages freed by exiting processes\n", sum.v_pfree);
+	(void)printf("%13lu pages active\n", sum.v_active_count);
+	(void)printf("%13lu pages inactive\n", sum.v_inactive_count);
+	(void)printf("%13lu pages in VM cache\n", sum.v_cache_count);
+	(void)printf("%13lu pages wired down\n", sum.v_wire_count);
+	(void)printf("%13lu pages free\n", sum.v_free_count);
+	(void)printf("%13lu bytes per page\n", sum.v_page_size);
 	kread(X_NCHSTATS, &nchstats, sizeof(nchstats));
 	nchtotal = nchstats.ncs_goodhits + nchstats.ncs_neghits +
 	    nchstats.ncs_badhits + nchstats.ncs_falsehits +
 	    nchstats.ncs_miss + nchstats.ncs_long;
-	(void)printf("%9ld total name lookups\n", nchtotal);
+	(void)printf("%13lu total name lookups\n", nchtotal);
 	(void)printf(
-	    "%9s cache hits (%ld%% pos + %ld%% neg) system %ld%% per-directory\n",
+	    "%13s cache hits (%lu%% pos + %lu%% neg) system %lu%% per-directory\n",
 	    "", PCT(nchstats.ncs_goodhits, nchtotal),
 	    PCT(nchstats.ncs_neghits, nchtotal),
 	    PCT(nchstats.ncs_pass2, nchtotal));
-	(void)printf("%9s deletions %ld%%, falsehits %ld%%, toolong %ld%%\n", "",
+	(void)printf("%13s deletions %lu%%, falsehits %lu%%, toolong %lu%%\n", "",
 	    PCT(nchstats.ncs_badhits, nchtotal),
 	    PCT(nchstats.ncs_falsehits, nchtotal),
 	    PCT(nchstats.ncs_long, nchtotal));


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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