svn commit: r208488 - in head/sys: kern sys
Konstantin Belousov
kib at FreeBSD.org
Mon May 24 10:23:50 UTC 2010
Author: kib
Date: Mon May 24 10:23:49 2010
New Revision: 208488
URL: http://svn.freebsd.org/changeset/base/208488
Log:
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
Modified:
head/sys/kern/kern_resource.c
head/sys/kern/kern_thread.c
head/sys/sys/resourcevar.h
Modified: head/sys/kern/kern_resource.c
==============================================================================
--- head/sys/kern/kern_resource.c Mon May 24 10:09:36 2010 (r208487)
+++ head/sys/kern/kern_resource.c Mon May 24 10:23:49 2010 (r208488)
@@ -76,7 +76,7 @@ static void calcru1(struct proc *p, stru
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_e
/*
* 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, st
rux->rux_iticks += td->td_iticks;
}
-static void
+void
ruxagg(struct proc *p, struct thread *td)
{
Modified: head/sys/kern/kern_thread.c
==============================================================================
--- head/sys/kern/kern_thread.c Mon May 24 10:09:36 2010 (r208487)
+++ head/sys/kern/kern_thread.c Mon May 24 10:23:49 2010 (r208488)
@@ -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
Modified: head/sys/sys/resourcevar.h
==============================================================================
--- head/sys/sys/resourcevar.h Mon May 24 10:09:36 2010 (r208487)
+++ head/sys/sys/resourcevar.h Mon May 24 10:23:49 2010 (r208488)
@@ -131,7 +131,7 @@ void rucollect(struct rusage *ru, struc
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);
More information about the svn-src-all
mailing list