svn commit: r236292 - in stable/9/sys: compat/freebsd32 kern sys vm
Konstantin Belousov
kib at FreeBSD.org
Wed May 30 04:51:24 UTC 2012
Author: kib
Date: Wed May 30 04:51:23 2012
New Revision: 236292
URL: http://svn.freebsd.org/changeset/base/236292
Log:
MFC r235850:
Calculate the count of per-process cow faults. Export the count to
userspace using the obscure spare int field in struct kinfo_proc.
MFC r236136:
Fix ki_cow for compat32 binaries.
Modified:
stable/9/sys/compat/freebsd32/freebsd32.h
stable/9/sys/kern/kern_proc.c
stable/9/sys/sys/proc.h
stable/9/sys/sys/user.h
stable/9/sys/vm/vm_fault.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/compat/freebsd32/freebsd32.h
==============================================================================
--- stable/9/sys/compat/freebsd32/freebsd32.h Wed May 30 04:16:54 2012 (r236291)
+++ stable/9/sys/compat/freebsd32/freebsd32.h Wed May 30 04:51:23 2012 (r236292)
@@ -297,7 +297,7 @@ struct kinfo_proc32 {
u_int ki_estcpu;
u_int ki_slptime;
u_int ki_swtime;
- int ki_spareint1;
+ u_int ki_cow;
u_int64_t ki_runtime;
struct timeval32 ki_start;
struct timeval32 ki_childtime;
Modified: stable/9/sys/kern/kern_proc.c
==============================================================================
--- stable/9/sys/kern/kern_proc.c Wed May 30 04:16:54 2012 (r236291)
+++ stable/9/sys/kern/kern_proc.c Wed May 30 04:51:23 2012 (r236292)
@@ -878,6 +878,9 @@ fill_kinfo_proc_only(struct proc *p, str
kp->ki_childtime = kp->ki_childstime;
timevaladd(&kp->ki_childtime, &kp->ki_childutime);
+ FOREACH_THREAD_IN_PROC(p, td0)
+ kp->ki_cow += td0->td_cow;
+
tp = NULL;
if (p->p_pgrp) {
kp->ki_pgid = p->p_pgrp->pg_id;
@@ -990,6 +993,7 @@ fill_kinfo_thread(struct thread *td, str
kp->ki_runtime = cputick2usec(td->td_rux.rux_runtime);
kp->ki_pctcpu = sched_pctcpu(td);
kp->ki_estcpu = td->td_estcpu;
+ kp->ki_cow = td->td_cow;
}
/* We can't get this anymore but ps etc never used it anyway. */
@@ -1132,6 +1136,7 @@ freebsd32_kinfo_proc_out(const struct ki
CP(*ki, *ki32, ki_estcpu);
CP(*ki, *ki32, ki_slptime);
CP(*ki, *ki32, ki_swtime);
+ CP(*ki, *ki32, ki_cow);
CP(*ki, *ki32, ki_runtime);
TV_CP(*ki, *ki32, ki_start);
TV_CP(*ki, *ki32, ki_childtime);
Modified: stable/9/sys/sys/proc.h
==============================================================================
--- stable/9/sys/sys/proc.h Wed May 30 04:16:54 2012 (r236291)
+++ stable/9/sys/sys/proc.h Wed May 30 04:51:23 2012 (r236292)
@@ -247,6 +247,7 @@ struct thread {
int td_slptick; /* (t) Time at sleep. */
int td_blktick; /* (t) Time spent blocked. */
int td_swvoltick; /* (t) Time at last SW_VOL switch. */
+ u_int td_cow; /* (*) Number of copy-on-write faults */
struct rusage td_ru; /* (t) rusage information. */
struct rusage_ext td_rux; /* (t) Internal rusage information. */
uint64_t td_incruntime; /* (t) Cpu ticks to transfer to proc. */
Modified: stable/9/sys/sys/user.h
==============================================================================
--- stable/9/sys/sys/user.h Wed May 30 04:16:54 2012 (r236291)
+++ stable/9/sys/sys/user.h Wed May 30 04:51:23 2012 (r236292)
@@ -159,7 +159,7 @@ struct kinfo_proc {
u_int ki_estcpu; /* Time averaged value of ki_cpticks */
u_int ki_slptime; /* Time since last blocked */
u_int ki_swtime; /* Time swapped in or out */
- int ki_spareint1; /* unused (just here for alignment) */
+ u_int ki_cow; /* number of copy-on-write faults */
u_int64_t ki_runtime; /* Real time in microsec */
struct timeval ki_start; /* starting time */
struct timeval ki_childtime; /* time used by process children */
Modified: stable/9/sys/vm/vm_fault.c
==============================================================================
--- stable/9/sys/vm/vm_fault.c Wed May 30 04:16:54 2012 (r236291)
+++ stable/9/sys/vm/vm_fault.c Wed May 30 04:51:23 2012 (r236292)
@@ -788,6 +788,7 @@ vnode_locked:
if (!is_first_object_locked)
VM_OBJECT_LOCK(fs.object);
PCPU_INC(cnt.v_cow_faults);
+ curthread->td_cow++;
} else {
prot &= ~VM_PROT_WRITE;
}
More information about the svn-src-stable-9
mailing list