LWN.net Logo

File descriptor handling changes in 2.6.27

File descriptor handling changes in 2.6.27

Posted Aug 5, 2008 21:45 UTC (Tue) by zlynx (subscriber, #2285)
In reply to: File descriptor handling changes in 2.6.27 by njs
Parent article: File descriptor handling changes in 2.6.27

Performance *does* matter.  I was working on speeding up gnome-terminal start.  First I used
my own version of readahead (renamed to readlock) to mlock all required files into RAM.  Then
it was still slower than xterm so I began stracing everything and I discovered that
gnome-terminal calls something like gnome-pty-helper, and that it does fork, then close 3-4096
(4096 was my max fd number), then pty-helper did it *again*.

I removed the close loop from pty-helper and also cut my max fds down to 256 and it was
noticably faster to start.

At any rate, using /proc and readdir to close only open fds is probably much faster than
blindly closing fds 3-256, let alone 3-4096.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds