summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exit.c5
-rw-r--r--sys/kern/kern_resource.c2
2 files changed, 4 insertions, 3 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);
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 397a7c5..ccfa07e 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -733,8 +733,8 @@ calcru(p, up, sp)
&pcpu_find(td->td_oncpu)->pc_switchtime);
}
}
- mtx_unlock_spin(&sched_lock);
calcru1(p, &rux, up, sp);
+ mtx_unlock_spin(&sched_lock);
p->p_rux.rux_uu = rux.rux_uu;
p->p_rux.rux_su = rux.rux_su;
p->p_rux.rux_iu = rux.rux_iu;
OpenPOWER on IntegriCloud