summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorups <ups@FreeBSD.org>2006-01-23 19:15:13 +0000
committerups <ups@FreeBSD.org>2006-01-23 19:15:13 +0000
commit18ba9270dcecbe786471c3cbc40adcb03ff9a786 (patch)
tree9ec7a8134eb6c450459b459b9d93289265f148d6 /sys/kern/kern_exit.c
parent54e5c67329366d24de694633c94a8d2640534095 (diff)
downloadFreeBSD-src-18ba9270dcecbe786471c3cbc40adcb03ff9a786.zip
FreeBSD-src-18ba9270dcecbe786471c3cbc40adcb03ff9a786.tar.gz
Hopefully fix the "calcru: runtime went backwards from ..." problem by
keeping the resource values locked (where needed) while we use them for calculations. MFC after: 3 days
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 56f800f..38e0131 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -437,14 +437,13 @@ retry:
/*
* Save exit status and finalize rusage info except for times,
- * adding in child rusage info.
+ * adding in child rusage info later when our time is locked.
*/
PROC_LOCK(p);
p->p_xstat = rv;
p->p_xthread = td;
p->p_stats->p_ru.ru_nvcsw++;
*p->p_ru = p->p_stats->p_ru;
- ruadd(p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
/*
* Notify interested parties of our demise.
@@ -531,6 +530,8 @@ retry:
p->p_state = PRS_ZOMBIE;
PROC_UNLOCK(p->p_pptr);
+ ruadd(p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
+
/* Do the same timestamp bookkeeping that mi_switch() would do. */
binuptime(&new_switchtime);
bintime_add(&p->p_rux.rux_runtime, &new_switchtime);
OpenPOWER on IntegriCloud