From owner-freebsd-current@FreeBSD.ORG Wed Jan 10 14:22:58 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CDE916A416; Wed, 10 Jan 2007 14:22:58 +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 1CEE613C43E; Wed, 10 Jan 2007 14:22:58 +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 D5AFC48B51; Wed, 10 Jan 2007 09:22:56 -0500 (EST) Date: Wed, 10 Jan 2007 14:22:56 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: John Baldwin In-Reply-To: <200701091426.36740.jhb@freebsd.org> Message-ID: <20070110142100.G52843@fledge.watson.org> References: <20070107171034.GA13836@crodrigues.org> <45A139CF.3090909@cisco.com> <20070107185228.W41371@fledge.watson.org> <200701091426.36740.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Craig Rodrigues , Randall Stewart , freebsd-current@freebsd.org Subject: Re: Witness warning with SCTP X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2007 14:22:58 -0000 On Tue, 9 Jan 2007, John Baldwin wrote: > Either that or use an sx lock to close the pcb alloc race instead and don't > hold mutexes while calling hashinit(). I think this is a good point -- I've generally been restructuring PCB init functions so that they perform allocation up front before acquiring locks in order to reduce lock contention on the table locks, which are global and acquired in many other paths. This tends to simplify error handling also. I'm not sure how well that applies in this case, however. Certainly, we want to optimize for successful handling, since malloc(9) failure is very unusual and occurs only in very exceptional (and unfortunate) cases. A more likely failure is the exhaustion of the zone limit on the pcb zone, which gates the overall allocation of memory for the socket type, and should be the first memory type allocated when setting up pcbs for this reason. Robert N M Watson Computer Laboratory University of Cambridge