amd64 cpu_switch in C.

David Xu davidxu at FreeBSD.org
Fri Mar 14 02:07:07 UTC 2008


Jeff Roberson wrote:

>> Ugh, this is from spinlocks bogusly masking interrupts.  More than half
>> the cycles have interrupts masked.  This at least shows that lots of
>> time is being spent near cpu_switch() with a spinlock held.
>>
> 
> I'm not sure why you feel masking interrupts in spinlocks is bogus.  
> It's central to our SMP strategy.  Unless you think we should do it 
> lazily like we do with critical_*.  I know jhb had that working at one 
> point but it was abandoned.

It may be that general mutex already does spinning, so spinlock is used
only when interrupt should be enabled and disabled which is expensive.
I don't know how many spinlocks are abused in CURRENT source code.

Regards,
David Xu



More information about the freebsd-arch mailing list