From owner-freebsd-arch@FreeBSD.ORG Tue May 29 21:57:22 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0A1DB16A474 for ; Tue, 29 May 2007 21:57:22 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from webaccess-cl.virtdom.com (webaccess-cl.virtdom.com [216.240.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id C211813C4DB for ; Tue, 29 May 2007 21:57:21 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from [192.168.1.101] (c-71-231-138-78.hsd1.or.comcast.net [71.231.138.78]) (authenticated bits=0) by webaccess-cl.virtdom.com (8.13.6/8.13.6) with ESMTP id l4TLvH2N020001 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Tue, 29 May 2007 17:57:18 -0400 (EDT) (envelope-from jroberson@chesapeake.net) Date: Tue, 29 May 2007 14:57:12 -0700 (PDT) From: Jeff Roberson X-X-Sender: jroberson@10.0.0.1 To: Bruce Evans In-Reply-To: <20070530072219.G11288@besplex.bde.org> Message-ID: <20070529145508.U661@10.0.0.1> References: <20070529105856.L661@10.0.0.1> <200705291456.38515.jhb@freebsd.org> <20070529121653.P661@10.0.0.1> <465C90F5.1000906@elischer.org> <20070530072219.G11288@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Julian Elischer , freebsd-arch@freebsd.org Subject: Re: rusage breakdown and cpu limits. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2007 21:57:22 -0000 On Wed, 30 May 2007, Bruce Evans wrote: > On Tue, 29 May 2007, Julian Elischer wrote: > >> Jeff Roberson wrote: >>> I think I'm going to make the rusage struct per-thread and aggregate it on >>> demand. There will be a lot of code churn, but it will be simple. There >>> are a few cases where which will be complicated, and cpulimit is one of >>> them. >> >> So, there should be somewhere to store the aggregated stats from threads >> that have already exited. > > We already have that. It is the per-process rusage. There is already > delayed accumulation for tick counts (these are currently accumulated in > the rusage from the thread at context switch time). There is also > delayed conversion of stats to the form needed by getrusage(). Stats > are kept in raw form as long as possible (forever if nothing calls > getrusage() or wait[34]() to look at them) to avoid conversion overhead > for them on every exit(). So there are many precedents for delayed > stats handling. >From thread_exit(): /* Add our usage into the usage of all our children. */ if (p->p_numthreads == 1) ruadd(p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux); Is the comment wrong or the code wrong? This adds our child's rusage to our own. I assume the comment is actually wrong and that we're adding our children's resource usage to our own so the pstats structure can be freed and our parent can aggregate it all together. Jeff > > Bruce >