From owner-svn-src-all@FreeBSD.ORG Tue Dec 17 19:36:48 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3F12F1F5; Tue, 17 Dec 2013 19:36:48 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 14ACF1443; Tue, 17 Dec 2013 19:36:48 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DF18FB97B; Tue, 17 Dec 2013 14:36:46 -0500 (EST) From: John Baldwin To: Mateusz Guzik Subject: Re: svn commit: r259407 - head/sys/kern Date: Tue, 17 Dec 2013 14:34:01 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: <201312150411.rBF4Bhtg018852@svn.freebsd.org> <201312171141.49251.jhb@freebsd.org> <20131217181745.GB7535@dft-labs.eu> In-Reply-To: <20131217181745.GB7535@dft-labs.eu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201312171434.01345.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 17 Dec 2013 14:36:47 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 17 Dec 2013 19:36:48 -0000 On Tuesday, December 17, 2013 1:17:45 pm Mateusz Guzik wrote: > On Tue, Dec 17, 2013 at 11:41:49AM -0500, John Baldwin wrote: > > On Saturday, December 14, 2013 11:11:43 pm Mateusz Guzik wrote: > > > Author: mjg > > > Date: Sun Dec 15 04:11:43 2013 > > > New Revision: 259407 > > > URL: http://svnweb.freebsd.org/changeset/base/259407 > > > > > > Log: > > > proc exit: don't take PROC_LOCK while freeing rlimits > > > > > > Code wishing to check rlimits of some process should check whether it > > > is exiting first, which current consumers do. > > > > Does this measurably reduce contention? > > > > No, this is just a cosmetic change I did while doing some other work > with rlimits. > > It would use some more cosmetic work (e.g. no reason not to > lim_free(p->plimit); p->p_limit = NULL) and maybe I'll get to that > later unless this kind of stuff is unwanted. I find it useful to leave the locking in place so it is clear that p_limit is always written to with the lock held. If we ever got a static analyzer that understood locking rules then leaving this locking in would reduce false positives. When I first did locking for fields in struct proc I did it by hand based on grepping the source tree for all uses of a field and ensuring they were locked. I think it might be more confusing later on for another reader to see unlocked access and then have to think about why that is safe. -- John Baldwin