summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2019-05-31 19:51:09 +0000
committermpi <mpi@openbsd.org>2019-05-31 19:51:09 +0000
commit4b91b74a18bc983f4cced5ae0e1d3b81f991786d (patch)
tree29d70291869a15eda0161c68981def08ec425f62 /sys/kern/kern_exec.c
parentRe-enable frame pointer elimination for x86 and mips64 if optimizations are (diff)
downloadwireguard-openbsd-4b91b74a18bc983f4cced5ae0e1d3b81f991786d.tar.xz
wireguard-openbsd-4b91b74a18bc983f4cced5ae0e1d3b81f991786d.zip
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_exec.c')
-rw-r--r--sys/kern/kern_exec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 88d3b1b47f7..b732e48a167 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.203 2019/02/08 12:51:57 bluhm Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.204 2019/05/31 19:51:09 mpi Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -661,8 +661,10 @@ sys_execve(struct proc *p, void *v, register_t *retval)
}
/* reset CPU time usage for the thread, but not the process */
+ mtx_enter(&pr->ps_mtx);
timespecclear(&p->p_tu.tu_runtime);
p->p_tu.tu_uticks = p->p_tu.tu_sticks = p->p_tu.tu_iticks = 0;
+ mtx_leave(&pr->ps_mtx);
km_free(argp, NCARGS, &kv_exec, &kp_pageable);