Re: MTX_DEF versus MTX_SPIN

From: Julian Elischer <julian_at_freebsd.org>
Date: Wed, 03 Nov 2010 15:01:16 -0700
On 11/3/10 10:52 AM, Julian Elischer wrote:
> On 11/3/10 10:17 AM, John Baldwin wrote:
>> On Wednesday, November 03, 2010 1:04:13 pm mdf_at_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.
>
oops
a line got deleted I think..
> 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,
  ... then the BTX_DEF code will spin for a short while before ...
> descheduling you. so you don't always incur the scheduling overhead.
>
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to 
> "freebsd-current-unsubscribe_at_freebsd.org"
>
Received on Wed Nov 03 2010 - 21:01:20 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:08 UTC