From f3e1e28bcceee1db82372dcd342c9a53783d88b3 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 26 May 2010 19:26:28 +0000 Subject: [PATCH] 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) --- sys/kern/kern_resource.c | 6 +++--- sys/kern/kern_thread.c | 2 +- sys/sys/resourcevar.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 0bc78d0ae2ed..c693d8340b9d 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 d7a9199c3e56..5d80016a06a2 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 diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index 95a9b49e1a6a..2d1c0ee8c2b6 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -131,7 +131,7 @@ void rucollect(struct rusage *ru, struct rusage *ru2); void rufetch(struct proc *p, struct rusage *ru); void rufetchcalc(struct proc *p, struct rusage *ru, struct timeval *up, 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); struct uidinfo *uifind(uid_t uid);