Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Feb 2006 13:43:48 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Andrew Thompson <thompsa@freebsd.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: rwlock patch for bridge
Message-ID:  <200602201343.49927.jhb@freebsd.org>
In-Reply-To: <20060219041012.GB78376@heff.fud.org.nz>
References:  <20060215211534.GA78376@heff.fud.org.nz> <200602171342.13451.jhb@freebsd.org> <20060219041012.GB78376@heff.fud.org.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday 18 February 2006 23:10, Andrew Thompson wrote:
> On Fri, Feb 17, 2006 at 01:42:11PM -0500, John Baldwin wrote:
> > On Wednesday 15 February 2006 16:15, Andrew Thompson wrote:
> > > Here is a patch that changes if_bridge to use rwlock(9) rather than the
> > > handrolled ref counting. Can I please get it reviewed to ensure I have
> > > the changes correct. I pondered if the order of unlocking the softc
> > > mutex and grabbing the rlock mattered but decided it didn't.
> >
> > Have you thought about replacing both the mutex and ref-count with the
> > single rwlock?  (Perhaps that is infeasible, but it would be somewhat
> > pointless to just lock one lock so you can turn around and lock the
> > next.)
>
> The bridge code makes use of callout_init_mtx(), can a rwlock be passed
> instead of a mutex?

No.  You could use callout_init() and mark it MPSAFE and handle the teardown 
race yourself perhaps.  I'd be interested in benchmarks, btw, of this patch 
as I'd imagine it is actually a pessimization because you are trading simple 
arith operations for atomic operations to mess with the rw lock.

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



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