Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Nov 2010 10:52:14 -0700
From:      Julian Elischer <julian@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        mdf@freebsd.org, freebsd-current@freebsd.org, Andriy Gapon <avg@icyb.net.ua>
Subject:   Re: MTX_DEF versus MTX_SPIN
Message-ID:  <4CD1A14E.8060508@freebsd.org>
In-Reply-To: <201011031317.36332.jhb@freebsd.org>
References:  <AANLkTi=12-dSAZ21DbZgw36YbRGiUq4KZbyCx3SjucPG@mail.gmail.com>	<4CD190EF.5080600@icyb.net.ua>	<AANLkTimmiQ9VH=cr%2BPJ4Hz=h1Oua%2Bouj7CAv8L__JeNn@mail.gmail.com> <201011031317.36332.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/3/10 10:17 AM, John Baldwin wrote:
> On Wednesday, November 03, 2010 1:04:13 pm mdf@freebsd.org wrote:
>>
>> So a MTX_DEF is okay in that environment?
> Yes.  In fact, the reason to have threads for interrupt handlers is to allow
> interrupt handlers to use non-spin locks that block when the lock is held.
>
> MTX_SPIN locks are generally not needed in device drivers.  The only reason a
> driver would use one is if it used a filter handler which does not run in a
> threaded context.

It should be noted that in the case where you really just want to spin 
a few
instructions because some other thread is accessing a structure you want,
descheduling you. so you don't always incur the scheduling overhead.




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