Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jul 2007 14:20:32 -0700
From:      Julian Elischer <julian@elischer.org>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: add closefrom() call
Message-ID:  <469549A0.70102@elischer.org>
In-Reply-To: <200707112114.l6BLERAF061933@apollo.backplane.com>
References:  <46930106.3040503@gmail.com>	<20070710123634.GD1194@britannica.bec.de> <4693C77E.7070806@elischer.org> <200707112114.l6BLERAF061933@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Dillon wrote:
>     We added it basically because doing all the junk described in
>     previous postings in this thread in userland is a ridiculously huge
>     eyesore that doesn't scale and doesn't make sense when 5 minutes of
>     programming nets you a shiny new system call which does it all for you.
> 
>     If you are worried about optimizing it (which kinda implies a system
>     call anyhow since you aren't doing a context switch for each descriptor),
>     worry about optimizing the kernel implementation of the system call
>     rather then optimizing the unoptimizable userland that eats 300ns+ per
>     descriptor to do the close() instead of the 10ns/descriptor that it
>     takes the kernel to do the close().

my thought exactly.
I also add that speed IS important in this case as I have seen MANY
programs that start up by closing the first 2048 descriptors "just in case"
and I've seen some that do it more than once as they move through to 
daemon state. These programs have a slow startp due to this (not to mention 
it's a pain to step past it all when debugging).

Julian


> 
> 						-Matt




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?469549A0.70102>