From owner-freebsd-arch@FreeBSD.ORG Tue May 29 21:10:34 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 30FDF16A400; Tue, 29 May 2007 21:10:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail33.syd.optusnet.com.au (mail33.syd.optusnet.com.au [211.29.132.104]) by mx1.freebsd.org (Postfix) with ESMTP id AA91F13C44C; Tue, 29 May 2007 21:10:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-225-63.carlnfd3.nsw.optusnet.com.au (c211-30-225-63.carlnfd3.nsw.optusnet.com.au [211.30.225.63]) by mail33.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id l4TLALPK016030 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 30 May 2007 07:10:22 +1000 Date: Wed, 30 May 2007 07:10:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Jeff Roberson In-Reply-To: <20070529121653.P661@10.0.0.1> Message-ID: <20070530065423.H93410@delplex.bde.org> References: <20070529105856.L661@10.0.0.1> <200705291456.38515.jhb@freebsd.org> <20070529121653.P661@10.0.0.1> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: 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:10:34 -0000 On Tue, 29 May 2007, Jeff Roberson wrote: > The problem with using a pool or per-process spinlock is that it keeps the > contention in the process domain, rather than thread domain. For > multithreaded processes this will give the same contention as a global > scheduler lock, only slightly reduced in scope. I'd like to solve this in > such a way that we don't have to revisit it again. > > 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 Ugh. > a few cases where which will be complicated, and cpulimit is one of them. No, cpulimit is simple because it can be fuzzy, unlike calcru() which require the rusage to be up to date. I see how rusage accumulation can help for everything _except_ the runtime and tick counts (i.e., for stuff updated by statclock()). For the runtime and tick counts, the possible savings seem to be small and negative. calcru() would have to run the accumulation code and the accumulation code would have to acquire something like sched_lock to transfer the per-thread data (since the lock for updating that data is something like sched_lock). This is has the same locking overheads and larger non-locking overheads than accumulating the runtime directly into the rusage at context switch time -- calcru() needs to acquire something like sched_lock either way. Bruce