Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9cfe015a authored by Eric Dumazet's avatar Eric Dumazet Committed by Linus Torvalds
Browse files

get rid of NR_OPEN and introduce a sysctl_nr_open



NR_OPEN (historically set to 1024*1024) actually forbids processes to open
more than 1024*1024 handles.

Unfortunatly some production servers hit the not so 'ridiculously high
value' of 1024*1024 file descriptors per process.

Changing NR_OPEN is not considered safe because of vmalloc space potential
exhaust.

This patch introduces a new sysctl (/proc/sys/fs/nr_open) wich defaults to
1024*1024, so that admins can decide to change this limit if their workload
needs it.

[akpm@linux-foundation.org: export it for sparc64]
Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 774ed22c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1029,6 +1029,14 @@ nr_inodes
Denotes the  number  of  inodes the system has allocated. This number will
grow and shrink dynamically.

nr_open
-------

Denotes the maximum number of file-handles a process can
allocate. Default value is 1024*1024 (1048576) which should be
enough for most machines. Actual limit depends on RLIMIT_NOFILE
resource limit.

nr_free_inodes
--------------

+10 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ Currently, these files are in /proc/sys/fs:
- inode-max
- inode-nr
- inode-state
- nr_open
- overflowuid
- overflowgid
- suid_dumpable
@@ -91,6 +92,15 @@ usage of file handles and you don't need to increase the maximum.

==============================================================

nr_open:

This denotes the maximum number of file-handles a process can
allocate. Default value is 1024*1024 (1048576) which should be
enough for most machines. Actual limit depends on RLIMIT_NOFILE
resource limit.

==============================================================

inode-max, inode-nr & inode-state:

As with file handles, the kernel allocates the inode structures
+1 −1
Original line number Diff line number Diff line
@@ -430,7 +430,7 @@ sys_getpagesize(void)
asmlinkage unsigned long
sys_getdtablesize(void)
{
	return NR_OPEN;
	return sysctl_nr_open;
}

/*
+1 −1
Original line number Diff line number Diff line
@@ -356,7 +356,7 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
			retval = NGROUPS_MAX;
			goto out;
		case 5:
			retval = NR_OPEN;
			retval = sysctl_nr_open;
			goto out;
		case 6:
			retval = 1;
+1 −0
Original line number Diff line number Diff line
@@ -277,6 +277,7 @@ EXPORT_SYMBOL(sys_getpid);
EXPORT_SYMBOL(sys_geteuid);
EXPORT_SYMBOL(sys_getuid);
EXPORT_SYMBOL(sys_getegid);
EXPORT_SYMBOL(sysctl_nr_open);
EXPORT_SYMBOL(sys_getgid);
EXPORT_SYMBOL(svr4_getcontext);
EXPORT_SYMBOL(svr4_setcontext);
Loading