What is mempages?
Hello !
I was looking at the document to find out how the default size of maximum file descriptor is decided by system.
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Performance_Tuning_Guide/sect-Red_Hat_Enterprise_Linux-Performance_Tuning_Guide-Configuration_tools-Configuring_system_memory_capacity.html#sect-Red_Hat_Enterprise_Linux-Performance_Tuning_Guide-Configuring_system_memory_capacity-File_system_parameters
In the document , there is a calculation ,
(mempages * (PAGE_SIZE / 1024)) / 10
What is "mempages" and how can I check the default size of this value?
Thanks,
Yu Watanabe
Responses
The mempages variable ends up being the total number of RAM pages in the system.
This was correct for RHEL6, but the calculation has changed in RHEL7:
void __init files_maxfiles_init(void)
{
unsigned long n;
unsigned long memreserve = (totalram_pages - nr_free_pages()) * 3/2;
memreserve = min(memreserve, totalram_pages - 1);
n = ((totalram_pages - memreserve) * (PAGE_SIZE / 1024)) / 10;
files_stat.max_files = max_t(unsigned long, n, NR_FILE);
}
The variable names totalram_pages and nr_free_pages are a bit more descriptive.
I have logged a bug against the documentation to correct this. For your reference, Red Hat Private Bug 1358602 - file-max calculation incorrect.
Hello,
I'm with the Red Hat docs team, and I've updated the Red Hat Enterprise Linux 7 Performance Tuning Guide based on information from Jamie (thanks!). Thank you for raising this issue.
When the guide is republished, it will say:
file-max
Determines the maximum number of file handles for the entire system. The default value on Red Hat Enterprise Linux 7 is the maximum of either 8192, or one tenth of the free memory pages available at the time the kernel starts.
Raising this value can resolve errors caused by a lack of available file handles.
Thanks again.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
