United States (change)
Shortcuts: Downloads Fedora Red Hat Network
Account Links: Cart Your Account Logout
The value that tracks file-max in the kernel is just an integer, so it can be set to any positive value (1 to 0x7fffffff). That does not mean that you can have that many open files though, just that the kernel will not deny you the attempt to get an unused file descriptor if you have fewer than that many files open.
What it boils down to is a memory game. You can set the file-max value as high as you want and in get_empty_filp (called in the kernel when you open a file), the file-max number is checked. If the current number of open files in the system is below the file max number you try to allocate a file pointer, otherwise you immediately fail. If you go to allocate a file pointer and there is not sufficient memory available you fail and get an error message about being unable to allocate a file pointer and the open request fails in userspace.
The default for NR_FILES on Red Hat Enterprise Linux 2.1 is defined as 8192. On Red Hat Enterprise Linux 3, the following code in the kernel determines the file-max value:
fs/file_table.c:
void __init files_init(unsigned long mempages)
{
int n;
/* One file with associated inode and dcache is very roughly 1K.
* Per default don't use more than 10% of our memory for files.
*/
n = (mempages * (PAGE_SIZE / 1024)) / 10;
files_stat.max_files = n;
if (files_stat.max_files < NR_FILE)
files_stat.max_files = NR_FILE;
}
See additional articles in the Knowledgebase that show you how to increase the file-max value for your system.