Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jan 2012 10:01:08 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-net@freebsd.org
Cc:        Vijay Singh <vijju.singh@gmail.com>
Subject:   Re: Use of spinlocks for TCP callouts
Message-ID:  <201201031001.09004.jhb@freebsd.org>
In-Reply-To: <CALCNsJRgboHoe7ec-7MQ4U2rOyO%2BbzodeicgMPLZyp2wLvwvAw@mail.gmail.com>
References:  <CALCNsJRgboHoe7ec-7MQ4U2rOyO%2BbzodeicgMPLZyp2wLvwvAw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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