Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ulimit: raise default hard ulimit on number of files to 4096

Apps are increasingly using more than 1024 file descriptors.  See
discussion in several distro bug trackers, e.g.  BugLink:
http://bugs.launchpad.net/bugs/663090
https://issues.rpath.com/browse/RPL-2054

You don't want to raise the default soft limit, since that might break
apps that use select(), but it's safe to raise the default hard limit;
that way, apps that know they need lots of file descriptors can raise
their soft limit without needing root, and without user intervention.

Ubuntu is doing this with a kernel change because they have a policy of
not changing kernel defaults in userland.

While 4096 might not be enough for *all* apps, it seems to be plenty for
the apps I've seen lately that are unhappy with 1024.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Cc: Dan Kegel <dank@kegel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information...
commit 16ae877631244b9248c866fa0be38dfeb1f568b2 1 parent d8a51e4
authored May 24, 2011 zachariasmaladroit committed February 12, 2012
2  include/asm-generic/resource.h
@@ -78,7 +78,7 @@
78 78
 	[RLIMIT_CORE]		= {              0,  RLIM_INFINITY },	\
79 79
 	[RLIMIT_RSS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
80 80
 	[RLIMIT_NPROC]		= {              0,              0 },	\
81  
-	[RLIMIT_NOFILE]		= {       INR_OPEN,       INR_OPEN },	\
  81
+	[RLIMIT_NOFILE]		= {   INR_OPEN_CUR,   INR_OPEN_MAX },	\
82 82
 	[RLIMIT_MEMLOCK]	= {    MLOCK_LIMIT,    MLOCK_LIMIT },	\
83 83
 	[RLIMIT_AS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
84 84
 	[RLIMIT_LOCKS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
3  include/linux/fs.h
@@ -23,7 +23,8 @@
23 23
 
24 24
 /* Fixed constants first: */
25 25
 #undef NR_OPEN
26  
-#define INR_OPEN 1024		/* Initial setting for nfile rlimits */
  26
+#define INR_OPEN_CUR 1024	/* Initial setting for nfile rlimits */
  27
+#define INR_OPEN_MAX 4096	/* Hard limit for nfile rlimits */
27 28
 
28 29
 #define BLOCK_SIZE_BITS 10
29 30
 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)

0 notes on commit 16ae877

Please sign in to comment.
Something went wrong with that request. Please try again.