Use of spinlocks for TCP callouts
John Baldwin
jhb at freebsd.org
Tue Jan 3 16:23:50 UTC 2012
On Monday, January 02, 2012 11:35:31 pm Vijay Singh wrote:
> I have see the following call sequence in profiles:
>
>
> called/total parents
> index %time self descendents called+self name index
> called/total children
>
> 0.02 1.14 3822699/7559737 tcp_do_segment
> [154] 0.5 0.03 2.26 7559737 callout_reset_on
> 2.19 0.02 7573352/94883048 spinlock_exit
> 0.01 0.04 7573352/11975031 callout_lock
>
> It is my perception that spinlocks are expensive. Since general TCP
> locks are sleep mutexes, would there be any merit in building a TCP
> callout facility using sleep mutexes? I can hack something up and
> share here but wanted to check if people know of an existing facility
> that might be used here?
The spinlock in question is probably the callout_mtx itself. The problem
is that you have to be able to acquire some sort of lock in the timer
interrupt to check the timer state to see if a timer thread should be
scheduled. That has to be a spin lock.
--
John Baldwin
More information about the freebsd-net
mailing list