summaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.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_fork.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_fork.c')
-rw-r--r--sys/kern/kern_fork.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 0d7f58bf890..4bf393afb84 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.210 2019/05/31 04:46:18 visa Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.211 2019/05/31 19:51:09 mpi Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -55,6 +55,7 @@
#include <sys/sysctl.h>
#include <sys/pool.h>
#include <sys/mman.h>
+#include <sys/mutex.h>
#include <sys/ptrace.h>
#include <sys/atomic.h>
#include <sys/pledge.h>
@@ -210,6 +211,8 @@ process_initialize(struct process *pr, struct proc *p)
LIST_INIT(&pr->ps_kqlist);
LIST_INIT(&pr->ps_sigiolst);
+ mtx_init(&pr->ps_mtx, IPL_MPFLOOR);
+
timeout_set(&pr->ps_realit_to, realitexpire, pr);
timeout_set(&pr->ps_rucheck_to, rucheck, pr);
}