Basically, each process has a limit as 1024. You can check and change this with ulimit command.
However, it does not change the overall counts of opened files on the machine. This is done with /proc/sys/fs/files-max.
This file’s value is set dynamically with available memory on the boot time, but, you change this later.
Related stuff for this tunnable varialbe is located at the fs/file_table.c
348void __init files_init(unsigned long mempages)
349{
350 int n;
351 /* One file with associated inode and dcache is very roughly 1K.
352 * Per default don't use more than 10% of our memory for files.
353 */
354
355 n = (mempages * (PAGE_SIZE / 1024)) / 10;
356 files_stat.max_files = n;
357 if (files_stat.max_files < NR_FILE)
358 files_stat.max_files = NR_FILE;
359 files_defer_init();
360 percpu_counter_init(&nr_files, 0);
361}
362
It basically set to spent less than 10% of the available memory.
Leave a Reply