Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 2013 14:34:01 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik <mjg@freebsd.org>
Subject:   Re: svn commit: r259407 - head/sys/kern
Message-ID:  <201312171434.01345.jhb@freebsd.org>
In-Reply-To: <20131217181745.GB7535@dft-labs.eu>
References:  <201312150411.rBF4Bhtg018852@svn.freebsd.org> <201312171141.49251.jhb@freebsd.org> <20131217181745.GB7535@dft-labs.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312171434.01345.jhb>