summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2004-06-21 14:03:38 +0000
committerbde <bde@FreeBSD.org>2004-06-21 14:03:38 +0000
commitb65b61b58aeaebbbf4262463c237a9a97d74b531 (patch)
tree2e6668c3086dbe734dc20c2ee1a5ec7400dc09c0 /sys
parentae2a2c5a14cfdb36af5430d18d9599b9a6ed3708 (diff)
downloadFreeBSD-src-b65b61b58aeaebbbf4262463c237a9a97d74b531.zip
FreeBSD-src-b65b61b58aeaebbbf4262463c237a9a97d74b531.tar.gz
Update p_runtime on exit. This fixes calcru() on zombies, and prepares
for not calling calcru() on exit. calcru() on a zombie can happen if ttyinfo() (^T) picks one. PR: 52490
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_exit.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 0817845..ba713e9 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -103,6 +103,7 @@ sys_exit(struct thread *td, struct sys_exit_args *uap)
void
exit1(struct thread *td, int rv)
{
+ struct bintime new_switchtime;
struct proc *p, *nq, *q;
struct tty *tp;
struct vnode *ttyvp;
@@ -517,10 +518,16 @@ retry:
mtx_lock_spin(&sched_lock);
critical_exit();
- cnt.v_swtch++;
- binuptime(PCPU_PTR(switchtime));
+
+ /* Do the same timestamp bookkeeping that mi_switch() would do. */
+ binuptime(&new_switchtime);
+ bintime_add(&p->p_runtime, &new_switchtime);
+ bintime_sub(&p->p_runtime, PCPU_PTR(switchtime));
+ PCPU_SET(switchtime, new_switchtime);
PCPU_SET(switchticks, ticks);
+ cnt.v_swtch++;
+
/*
* Allow the scheduler to adjust the priority of the
* parent when a kseg is exiting.
OpenPOWER on IntegriCloud