From owner-cvs-src@FreeBSD.ORG Sat Feb 7 18:26:57 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A024F16A4DC; Sat, 7 Feb 2004 18:26:57 -0800 (PST) Received: from mx1.rootauthority.us (adsl-66-123-229-170.dsl.sndg02.pacbell.net [66.123.229.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id 34BE543D1F; Sat, 7 Feb 2004 18:26:57 -0800 (PST) (envelope-from __zma@rootauthority.us) Received: by mx1.rootauthority.us (Postfix, from userid 1021) id 5E6F3B817; Sat, 7 Feb 2004 18:26:56 -0800 (PST) Received: from pop.cotse.com by localhost with POP3 (fetchmail-6.2.5) for __zma@localhost (single-drop); Sat, 07 Feb 2004 18:26:56 -0800 (PST) Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by mailhost.cotse.com (5.7.4/5.7.4) with ESMTP id i17L5HuU071848 for ; Sat, 7 Feb 2004 16:05:17 -0500 (EST) (envelope-from owner-cvs-all@freebsd.org) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 4F8CF55E53; Sat, 7 Feb 2004 13:05:01 -0800 (PST) (envelope-from owner-cvs-all@freebsd.org) Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id D73BC16A4F0; Sat, 7 Feb 2004 13:04:59 -0800 (PST) Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A463616A4CE; Sat, 7 Feb 2004 13:04:47 -0800 (PST) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 287CE43D1F; Sat, 7 Feb 2004 13:04:47 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87])i17L4k5O003624; Sun, 8 Feb 2004 08:04:46 +1100 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i17L4hYc023959; Sun, 8 Feb 2004 08:04:44 +1100 Date: Sun, 8 Feb 2004 08:04:43 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Tim Robbins In-Reply-To: <20040206221255.GA54490@cat.robbins.dropbear.id.au> Message-ID: <20040208074351.Y58537@gamplex.bde.org> References: <200402061930.i16JUCpa011145@repoman.freebsd.org> <20040206221255.GA54490@cat.robbins.dropbear.id.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Sender: owner-cvs-all@freebsd.org Errors-To: owner-cvs-all@freebsd.org X-Cotse-Filters: Default delivery X-UIDL: -S~"!9jI"!*ag!!^YP!! cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: John Baldwin cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/kern kern_resource.c X-BeenThere: cvs-src@freebsd.org List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Feb 2004 02:26:57 -0000 On Sat, 7 Feb 2004, Tim Robbins wrote: > On Fri, Feb 06, 2004 at 11:30:12AM -0800, John Baldwin wrote: > > > jhb 2004/02/06 11:30:12 PST > > > > FreeBSD src repository > > > > Modified files: > > sys/kern kern_resource.c > > Log: > > - Correct the translation of old rlimit values to properly handle the old > > RLIM_INFINITY case for ogetrlimit(). > > - Use %jd and intmax_t to output negative time in usec in calcru(). > > - Rework getrusage() to make a copy of the rusage struct into a local > > variable while holding Giant and then do the copyout from the local > > variable to avoid having to have the original process rusage struct > > locked while doing the copyout (which would not be safe). This also > > includes a few style fixes from Bruce to getrusage(). > > Thanks (from the one who added the XXX comment). Can't we use the > proc lock here though? I had it changed to use sched_lock for a few minutes, then decided that Giant was not too bad here. We already have to use sched_lock for the RUSAGE_SELF case so it's silly to use another lock too. The p_cru change in kern_exit.c is locked by the following: Giant, PROC_LOCK(p), and not quite by sched_lock (sched_lock is released just before), so we can use any of these in getrusage(). I decided not to use sched_lock because I want to drop it earlier (after readinf the times in calcru()). calcru() takes about 4.5 usec on a Celeron 366 with a TSC timecounter, and this is too long to hold a spin lock since, while it is not too bad in absolute terms, it scales to 100+ usec on old machines that used to have an interrupt latency of much smaller than 100 usec. Another way to look at the relative largeness of 4.5 usec: vfork()+exit()+wait() for a small process takes about 86 usec on a Celeron 366, and 4.5 usec of that is for calcru(). Bruce _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"