From 9cfe015aa424b3c003baba3841a60dd9b5ad319b Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 6 Feb 2008 01:37:16 -0800 Subject: 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: Eric Dumazet Cc: Alan Cox Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: "David S. Miller" Cc: Ralf Baechle Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc64/solaris/fs.c | 2 +- arch/sparc64/solaris/timod.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'arch/sparc64/solaris') diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c index 61be597bf430..9311bfe4f2f7 100644 --- a/arch/sparc64/solaris/fs.c +++ b/arch/sparc64/solaris/fs.c @@ -624,7 +624,7 @@ asmlinkage int solaris_ulimit(int cmd, int val) case 3: /* UL_GMEMLIM */ return current->signal->rlim[RLIMIT_DATA].rlim_cur; case 4: /* UL_GDESLIM */ - return NR_OPEN; + return sysctl_nr_open; } return -EINVAL; } diff --git a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c index a9d32ceabf26..f53123c02c2b 100644 --- a/arch/sparc64/solaris/timod.c +++ b/arch/sparc64/solaris/timod.c @@ -859,7 +859,8 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) SOLD("entry"); lock_kernel(); - if(fd >= NR_OPEN) goto out; + if (fd >= sysctl_nr_open) + goto out; fdt = files_fdtable(current->files); filp = fdt->fd[fd]; @@ -927,7 +928,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) SOLD("entry"); lock_kernel(); - if(fd >= NR_OPEN) goto out; + if (fd >= sysctl_nr_open) + goto out; fdt = files_fdtable(current->files); filp = fdt->fd[fd]; -- cgit v1.2.3