summaryrefslogtreecommitdiff
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authorAttilio Rao <attilio@FreeBSD.org>2007-06-09 18:56:11 +0000
committerAttilio Rao <attilio@FreeBSD.org>2007-06-09 18:56:11 +0000
commita140976eb44efd308803d4603b1cff9a759265ab (patch)
tree5f11084a1ca726fd09afccfce5eb4c0055b06e97 /sys/kern/kern_thread.c
parent65d32cd8fb71089a2d627cf15708701446dcffda (diff)
Notes
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r--sys/kern/kern_thread.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 56de5c2aa304..9c1c02d51d35 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -391,9 +391,9 @@ thread_exit(void)
PCPU_SET(switchtime, new_switchtime);
PCPU_SET(switchticks, ticks);
PCPU_INC(cnt.v_swtch);
- /* Add the child usage to our own when the final thread exits. */
- if (p->p_numthreads == 1)
- ruadd(p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
+ /* Save our resource usage in our process. */
+ td->td_ru.ru_nvcsw++;
+ rucollect(&p->p_ru, &td->td_ru);
/*
* The last thread is left attached to the process
* So that the whole bundle gets recycled. Skip
@@ -411,9 +411,7 @@ thread_exit(void)
thread_unlink(td);
#endif
thread_unlock(td);
- /* Impart our resource usage on another thread */
td2 = FIRST_THREAD_IN_PROC(p);
- rucollect(&td2->td_ru, &td->td_ru);
sched_exit_thread(td2, td);
/*
@@ -462,7 +460,7 @@ thread_exit(void)
}
PROC_UNLOCK(p);
thread_lock(td);
- /* Aggregate our tick statistics into our parents rux. */
+ /* Save our tick information with both the thread and proc locked */
ruxagg(&p->p_rux, td);
PROC_SUNLOCK(p);
td->td_state = TDS_INACTIVE;