Subject: is this a good vm_fault.c fix?
To: None <current-users@NetBSD.ORG>
From: Kenneth Stailey <kstailey@owl.dol-esa.gov>
List: current-users
Date: 08/19/1995 14:22:39
Hi,

I found a way to patch vm_fault.c to record per-process page faults in
the user structure.  This makes "ps -avx" print something other than
zero for "pagein".  It also helps track down what's causing all the
page faults on a busy system.

Only problem is I have no idea if it's complete or reasonable.  It is
small, and has not caused any panics since I wrote it 30 minutes ago
or so. :-)

feedback?

--- vm_fault.c.orig	Sat Aug 19 13:58:06 1995
+++ vm_fault.c	Sat Aug 19 13:38:08 1995
@@ -69,7 +69,9 @@
  */
 
 #include <sys/param.h>
+#include <sys/proc.h>
 #include <sys/systm.h>
+#include <sys/user.h>
 
 #include <vm/vm.h>
 #include <vm/vm_page.h>
@@ -324,6 +326,8 @@
 			 */
 			UNLOCK_MAP;
 			cnt.v_pageins++;
+			if (curproc)
+				curproc->p_addr->u_stats.p_ru.ru_majflt++;
 			rv = vm_pager_get(object->pager, m, TRUE);
 
 			/*