diff options
| author | 2019-05-31 19:51:09 +0000 | |
|---|---|---|
| committer | 2019-05-31 19:51:09 +0000 | |
| commit | 4b91b74a18bc983f4cced5ae0e1d3b81f991786d (patch) | |
| tree | 29d70291869a15eda0161c68981def08ec425f62 /sys/kern/kern_exit.c | |
| parent | Re-enable frame pointer elimination for x86 and mips64 if optimizations are (diff) | |
| download | wireguard-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_exit.c')
| -rw-r--r-- | sys/kern/kern_exit.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index bff9a2c5ef7..1c9a522ba14 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.174 2019/05/13 19:21:31 bluhm Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.175 2019/05/31 19:51:09 mpi Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -284,7 +284,7 @@ exit1(struct proc *p, int rv, int flags) /* add thread's accumulated rusage into the process's total */ ruadd(rup, &p->p_ru); - tuagg(pr, p); + tuagg(p, NULL); /* * clear %cpu usage during swap @@ -296,7 +296,9 @@ exit1(struct proc *p, int rv, int flags) * Final thread has died, so add on our children's rusage * and calculate the total times */ + mtx_enter(&pr->ps_mtx); calcru(&pr->ps_tu, &rup->ru_utime, &rup->ru_stime, NULL); + mtx_leave(&pr->ps_mtx); ruadd(rup, &pr->ps_cru); /* notify interested parties of our demise and clean up */ |
