From owner-freebsd-current@FreeBSD.ORG Thu Dec 4 00:28:12 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5ECEC16A4CF for ; Thu, 4 Dec 2003 00:28:12 -0800 (PST) Received: from smtp02.syd.iprimus.net.au (smtp02.syd.iprimus.net.au [210.50.76.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6BDEC43F85 for ; Thu, 4 Dec 2003 00:28:11 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from robbins.dropbear.id.au (210.50.217.9) by smtp02.syd.iprimus.net.au (7.0.020) id 3F8F522A01108C6C for current@FreeBSD.ORG; Thu, 4 Dec 2003 19:28:09 +1100 Received: by robbins.dropbear.id.au (Postfix, from userid 1000) id 7D50F60FB; Thu, 4 Dec 2003 19:32:56 +1100 (EST) Date: Thu, 4 Dec 2003 19:32:56 +1100 From: Tim Robbins To: current@FreeBSD.ORG Message-ID: <20031204083256.GA39396@wombat.robbins.dropbear.id.au> References: <20031127070239.GA12950@wombat.robbins.dropbear.id.au> <20031204075445.GA96485@VARK.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031204075445.GA96485@VARK.homeunix.com> User-Agent: Mutt/1.4.1i Subject: Re: Port of Niels Provos's file descriptor allocation code X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Thu, 04 Dec 2003 08:28:12 -0000 On Wed, Dec 03, 2003 at 11:54:45PM -0800, David Schultz wrote: > On Thu, Nov 27, 2003, Tim Robbins wrote: > > I've ported Niels Provos's file descriptor allocation code to FreeBSD > > in case anyone wants to try it out & run some benchmarks. If the performance > > boost turns out to be worth the added complexity, I might clean it up a > > bit and commit it. > > I've used a similar data structure for a special-purpose allocator > before, and it had extremely low allocation time overhead--- > basically a few memory references for every level of the tree > in the common case. Unless for some strange reason it pessimizes > processes with a small number of file descriptors significantly, > it would be really great to have this in the tree! It doesn't seem to make a noticeable impact on execution time for processes with small numbers of descriptors. It's probably swamped by the overhead of mode switches, locking, and filesystem operations. What makes uneasy is the amount of extra memory it consumes when processes have a small number of descriptors: (32**2)/8 = 128 bytes (when int is 32 bits), or (64**2)/8 = 512 bytes (when int is 64 bits). I've been thinking of switching to a flat bitmap for small fd tables, possibly just using a single "int", or falling back to the old way of scanning fd_ofiles directly. Once I decide what to do about that and find someone to test my latest patch on a 64-bit machine, I'll commit it. Tim