Re: Port of Niels Provos's file descriptor allocation code

From: Tim Robbins <tjr_at_freebsd.org>
Date: Thu, 4 Dec 2003 19:32:56 +1100
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
Received on Wed Dec 03 2003 - 23:28:12 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:32 UTC