MFC r208488:

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.

Approved by:	re (kensmith)
This commit is contained in:
Konstantin Belousov 2010-05-26 19:26:28 +00:00
parent 7b0f9e6cc7
commit f3e1e28bcc
3 changed files with 5 additions and 5 deletions

View File

@ -76,7 +76,7 @@ static void calcru1(struct proc *p, struct rusage_ext *ruxp,
struct timeval *up, struct timeval *sp); struct timeval *up, struct timeval *sp);
static int donice(struct thread *td, struct proc *chgp, int n); static int donice(struct thread *td, struct proc *chgp, int n);
static struct uidinfo *uilookup(uid_t uid); 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. * 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. * Aggregate tick counts into the proc's rusage_ext.
*/ */
void static void
ruxagg_locked(struct rusage_ext *rux, struct thread *td) 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; rux->rux_iticks += td->td_iticks;
} }
static void void
ruxagg(struct proc *p, struct thread *td) ruxagg(struct proc *p, struct thread *td)
{ {

View File

@ -430,8 +430,8 @@ thread_exit(void)
PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT);
#endif #endif
PROC_UNLOCK(p); PROC_UNLOCK(p);
ruxagg(p, td);
thread_lock(td); thread_lock(td);
ruxagg_locked(&p->p_rux, td);
PROC_SUNLOCK(p); PROC_SUNLOCK(p);
td->td_state = TDS_INACTIVE; td->td_state = TDS_INACTIVE;
#ifdef WITNESS #ifdef WITNESS

View File

@ -131,7 +131,7 @@ void rucollect(struct rusage *ru, struct rusage *ru2);
void rufetch(struct proc *p, struct rusage *ru); void rufetch(struct proc *p, struct rusage *ru);
void rufetchcalc(struct proc *p, struct rusage *ru, struct timeval *up, void rufetchcalc(struct proc *p, struct rusage *ru, struct timeval *up,
struct timeval *sp); struct timeval *sp);
void ruxagg_locked(struct rusage_ext *rux, struct thread *td); void ruxagg(struct proc *p, struct thread *td);
int suswintr(void *base, int word); int suswintr(void *base, int word);
struct uidinfo struct uidinfo
*uifind(uid_t uid); *uifind(uid_t uid);