From owner-freebsd-net@FreeBSD.ORG Wed Mar 12 17:56:00 2008 Return-Path: Delivered-To: net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFFF11065670 for ; Wed, 12 Mar 2008 17:56:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8B1378FC15 for ; Wed, 12 Mar 2008 17:56:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 6A15246B96 for ; Wed, 12 Mar 2008 13:55:59 -0400 (EDT) Date: Wed, 12 Mar 2008 17:55:59 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: net@FreeBSD.org Message-ID: <20080312175151.V47697@fledge.watson.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: FYI: inpcb/pcbinfo mutex -> rwlock at some point in the mid-distant future 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: Wed, 12 Mar 2008 17:56:00 -0000 FYI: Kris Kennaway and I have been working on diagnosing and addressing network stack contention and scheduling issues for high performance DNS serving with nsd and bind9. One of the changes in the pipeline is converting from using a mutex to protect the pcbinfo and inpcb data structures to an rwlock, so that UDP, which doesn't require exclusion for either of those structures in a number of key cases, doesn't have to experience as high contention. TCP would continue to use them only exclusively [for now]. This is a heads up that this change will likely end up in HEAD in the next month or two, but we're still working through some issues. This may well be something that can be MFC'd as rwlocks are intentionally fairly layout compatible with mutexes, and these locks and the data structures they protect are not considered "public" structures from the perspective of most kernel modules (although there are potentially issues with firewalls that reach "up" the stack to look at th connection table). One of those issues is that we need to demonstrate to ourselves that exclusive access contention is managed as well with rwlocks as with sleep mutexes, as these locks would continue to be fairly highly contended in TCP. The other issue is that rwlocks don't support full priority propagation for reader access, although Jeff Roberson has recently improved fairness to writers with many readers. Robert N M Watson Computer Laboratory University of Cambridge