From owner-freebsd-current@FreeBSD.ORG Thu Dec 4 07:24:31 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 05E4F16A4CE; Thu, 4 Dec 2003 07:24:31 -0800 (PST) Received: from smtp.des.no (flood.des.no [217.116.83.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF27B43FCB; Thu, 4 Dec 2003 07:24:21 -0800 (PST) (envelope-from des@des.no) Received: by smtp.des.no (Pony Express, from userid 666) id 9DCFE530C; Thu, 4 Dec 2003 16:24:20 +0100 (CET) Received: from dwp.des.no (des.no [80.203.228.37]) by smtp.des.no (Pony Express) with ESMTP id E6D545308; Thu, 4 Dec 2003 16:24:10 +0100 (CET) Received: by dwp.des.no (Postfix, from userid 2602) id 5FA0C33C6A; Thu, 4 Dec 2003 16:24:10 +0100 (CET) To: Tim Robbins References: <20031127070239.GA12950@wombat.robbins.dropbear.id.au> <20031204075445.GA96485@VARK.homeunix.com> <20031204083256.GA39396@wombat.robbins.dropbear.id.au> From: des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=) Date: Thu, 04 Dec 2003 16:24:10 +0100 In-Reply-To: <20031204083256.GA39396@wombat.robbins.dropbear.id.au> (Tim Robbins's message of "Thu, 4 Dec 2003 19:32:56 +1100") Message-ID: User-Agent: Gnus/5.090024 (Oort Gnus v0.24) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on flood.des.no X-Spam-Level: X-Spam-Status: No, hits=0.1 required=5.0 tests=RCVD_IN_SORBS autolearn=no version=2.60 cc: current@FreeBSD.ORG 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 15:24:31 -0000 Tim Robbins writes: > It doesn't seem to make a noticeable impact on execution time for process= es > with small numbers of descriptors. It's probably swamped by the overhead = of > mode switches, locking, and filesystem operations. What makes uneasy is t= he > amount of extra memory it consumes when processes have a small number of > descriptors: (32**2)/8 =3D 128 bytes (when int is 32 bits), or (64**2)/8 = =3D > 512 bytes (when int is 64 bits). I'm not sure where you get these numbers from. Actual growth of struct filedesc is: - two pointers - one 32-bit int (himap) (used when nfiles <=3D 1024) - one array of 32 32-bit ints (lomap) (used when nfiles <=3D 1024) For higher values of nfiles, larger arrays are malloc'ed and the static arrays are left unused. The total is 35*4 =3D 140 bytes per struct filedesc on 32-bit platforms and 2*8 + 33*4 =3D 148 bytes per struct filedesc on 64-bit platforms. Modifying the code to use 64-bit ints on 64-bit platforms would change that number to 67*8 =3D 536 bytes per struct filedesc, but the cutoff would be at nfiles =3D=3D 4096 instead of 1024. > 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. That would increase code complexity. The patch already increases fd allocation overhead by about 7% on my ev56 and 1% on my p4 for low values of nfiles (though the performance improvement for higher values is immense). It is possible that a pure 64-bit implementation would fare better on the Alpha than the current 32-bit implementation. > Once I decide what to > do about that and find someone to test my latest patch on a 64-bit machin= e, > I'll commit it. It works fine on my Alpha, using 32-bit ints. I haven't tried modifying the patch to use 64-bit ints on 64-bit platforms. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no