From owner-freebsd-net@FreeBSD.ORG Tue Jan 3 16:23:50 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FF51106564A for ; Tue, 3 Jan 2012 16:23:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 774138FC08 for ; Tue, 3 Jan 2012 16:23:50 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 2F81A46B0D; Tue, 3 Jan 2012 11:23:50 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 69FA2B960; Tue, 3 Jan 2012 11:23:49 -0500 (EST) From: John Baldwin To: freebsd-net@freebsd.org Date: Tue, 3 Jan 2012 10:01:08 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201201031001.09004.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 03 Jan 2012 11:23:49 -0500 (EST) Cc: Vijay Singh Subject: Re: Use of spinlocks for TCP callouts X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 16:23:50 -0000 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