Subject: kern/1397: paging stats are not kept in "user struct"
To: None <gnats-bugs@gnats.netbsd.org>
From: Kenneth Stailey <kstailey@owl.dol-esa.gov>
List: netbsd-bugs
Date: 08/21/1995 15:22:02
>Number:         1397
>Category:       kern
>Synopsis:       paging stats are not kept in "user struct"
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 21 15:35:02 1995
>Last-Modified:
>Originator:     Kenneth Stailey
>Organization:
DOL/ESA/DASM
>Release:        August 9, 1995
>Environment:
	
System: NetBSD owl 1.0A NetBSD 1.0A (OWL) #0: Mon Aug 21 13:03:39 EDT 1995 kstailey@owl:/usr/obj/sys/arch/i386/compile/OWL i386


>Description:
	The user struct contains the pstats struct which contains the
	process's rusage struct.  The rusage struct has a member called
	ru_majflt which used to be (on 4.3BSD) incremented every time
	the process took a page fault.

	This stopped happening when BSD got it's shiny new VM system from 
	Mach.  It is easy to put back, let's do it.
>How-To-Repeat:
	
	Run "ps -axv", notice that the "pagein" column is always all zeros.
>Fix:
	

owl% ident /sys/vm/vm_fault.c 
/sys/vm/vm_fault.c:
     $NetBSD: vm_fault.c,v 1.16 1994/09/07 20:25:07 mycroft Exp $

--- 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);
 
 			/*
>Audit-Trail:
>Unformatted: