Index: kern_exit.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_exit.c,v retrieving revision 1.263.2.5 diff -u -r1.263.2.5 kern_exit.c --- kern_exit.c 10 Dec 2005 20:14:42 -0000 1.263.2.5 +++ kern_exit.c 5 Mar 2006 12:17:38 -0000 @@ -106,7 +106,6 @@ void exit1(struct thread *td, int rv) { - struct bintime new_switchtime; struct proc *p, *nq, *q; struct tty *tp; struct vnode *ttyvp; @@ -435,7 +434,6 @@ 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. @@ -515,17 +513,10 @@ */ wakeup(p->p_pptr); mtx_lock_spin(&sched_lock); + ruadd(p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux); p->p_state = PRS_ZOMBIE; PROC_UNLOCK(p->p_pptr); - /* Do the same timestamp bookkeeping that mi_switch() would do. */ - binuptime(&new_switchtime); - bintime_add(&p->p_rux.rux_runtime, &new_switchtime); - bintime_sub(&p->p_rux.rux_runtime, PCPU_PTR(switchtime)); - PCPU_SET(switchtime, new_switchtime); - PCPU_SET(switchticks, ticks); - cnt.v_swtch++; - sched_exit(p->p_pptr, td); /* Index: kern_thread.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_thread.c,v retrieving revision 1.216.2.2 diff -u -r1.216.2.2 kern_thread.c --- kern_thread.c 27 Feb 2006 00:19:40 -0000 1.216.2.2 +++ kern_thread.c 5 Mar 2006 12:17:38 -0000 @@ -439,6 +439,7 @@ void thread_exit(void) { + struct bintime new_switchtime; struct thread *td; struct proc *p; struct ksegrp *kg; @@ -566,6 +567,15 @@ */ PROC_UNLOCK(p); } + + /* Do the same timestamp bookkeeping that mi_switch() would do. */ + binuptime(&new_switchtime); + bintime_add(&p->p_rux.rux_runtime, &new_switchtime); + bintime_sub(&p->p_rux.rux_runtime, PCPU_PTR(switchtime)); + PCPU_SET(switchtime, new_switchtime); + PCPU_SET(switchticks, ticks); + cnt.v_swtch++; + td->td_state = TDS_INACTIVE; CTR1(KTR_PROC, "thread_exit: cpu_throw() thread %p", td); cpu_throw(td, choosethread());