summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sysctl.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2019-05-31 19:51:11 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2019-05-31 19:51:11 +0000
commitd167771038a85ab61b62b28d6b595c94a69282c3 (patch)
tree0a5e7dd20317c2cab573090ffc63da64440423ab /sys/kern/kern_sysctl.c
parent03a70f9f0b906196738e80f6df8c37a1c4a6e519 (diff)
Use a per-process mutex to protect time accounting instead of SCHED_LOCK().
Note that hardclock(9) still increments p_{u,s,i}ticks without holding a lock. ok visa@, cheloha@
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r--sys/kern/kern_sysctl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 82f26655caf..adb4f166533 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.356 2019/05/22 18:45:07 claudio Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.357 2019/05/31 19:51:09 mpi Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1645,7 +1645,9 @@ fill_kproc(struct process *pr, struct kinfo_proc *ki, struct proc *p,
if ((pr->ps_flags & PS_ZOMBIE) == 0) {
if ((pr->ps_flags & PS_EMBRYO) == 0 && vm != NULL)
ki->p_vm_rssize = vm_resident_count(vm);
+ mtx_enter(&pr->ps_mtx);
calctsru(isthread ? &p->p_tu : &pr->ps_tu, &ut, &st, NULL);
+ mtx_leave(&pr->ps_mtx);
ki->p_uutime_sec = ut.tv_sec;
ki->p_uutime_usec = ut.tv_nsec/1000;
ki->p_ustime_sec = st.tv_sec;