diff options
author | kib <kib@FreeBSD.org> | 2010-05-24 10:23:49 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2010-05-24 10:23:49 +0000 |
commit | 70f08890fc1cf735f25aaa4982c4789edc7337f2 (patch) | |
tree | cd49357688cc128dd42128ed9daecb2e0f7af65e /sys/kern | |
parent | ab9f5dbe35c315e6966c118cb2076d184be6c09f (diff) | |
download | FreeBSD-src-70f08890fc1cf735f25aaa4982c4789edc7337f2.zip FreeBSD-src-70f08890fc1cf735f25aaa4982c4789edc7337f2.tar.gz |
Fix the double counting of the last process thread td_incruntime
on exit, that is done once in thread_exit() and the second time in
proc_reap(), by clearing td_incruntime.
Use the opportunity to revert to the pre-RUSAGE_THREAD exporting of ruxagg()
instead of ruxagg_locked() and use it from thread_exit().
Diagnosed and tested by: neel
MFC after: 3 days
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_resource.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_thread.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 0bc78d0..c693d83 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -76,7 +76,7 @@ static void calcru1(struct proc *p, struct rusage_ext *ruxp, struct timeval *up, struct timeval *sp); static int donice(struct thread *td, struct proc *chgp, int n); static struct uidinfo *uilookup(uid_t uid); -static void ruxagg(struct proc *p, struct thread *td); +static void ruxagg_locked(struct rusage_ext *rux, struct thread *td); /* * Resource controls and accounting. @@ -1010,7 +1010,7 @@ ruadd(struct rusage *ru, struct rusage_ext *rux, struct rusage *ru2, /* * Aggregate tick counts into the proc's rusage_ext. */ -void +static void ruxagg_locked(struct rusage_ext *rux, struct thread *td) { @@ -1022,7 +1022,7 @@ ruxagg_locked(struct rusage_ext *rux, struct thread *td) rux->rux_iticks += td->td_iticks; } -static void +void ruxagg(struct proc *p, struct thread *td) { diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index d7a9199..5d80016 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -430,8 +430,8 @@ thread_exit(void) PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); #endif PROC_UNLOCK(p); + ruxagg(p, td); thread_lock(td); - ruxagg_locked(&p->p_rux, td); PROC_SUNLOCK(p); td->td_state = TDS_INACTIVE; #ifdef WITNESS |