Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Enterprise Linux > AS/ES/WS v. 3 > Issue <<  206 of 594 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 4228
Last update: 05-11-06
Issue:
What is the maximum value that file-max can be set to in /proc/sys/fs/ for Red Hat Enterprise Linux 3?
Resolution:

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.


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Enterprise Linux > AS/ES/WS v. 3 > Issue <<   206  of  594  >>