From owner-svn-src-all@FreeBSD.ORG Mon May 24 10:23:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D695106566C; Mon, 24 May 2010 10:23:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 254628FC1A; Mon, 24 May 2010 10:23:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4OANoT1071294; Mon, 24 May 2010 10:23:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4OANnF8071290; Mon, 24 May 2010 10:23:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005241023.o4OANnF8071290@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 24 May 2010 10:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208488 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 May 2010 10:23:50 -0000 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);