Skip to content

Commit 0ac1ee0

Browse files
rtg-canonicaltorvalds
authored andcommitted
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 <[email protected]> Cc: Dan Kegel <[email protected]> Cc: Al Viro <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent db271cf commit 0ac1ee0

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

include/asm-generic/resource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
[RLIMIT_CORE] = { 0, RLIM_INFINITY }, \
7979
[RLIMIT_RSS] = { RLIM_INFINITY, RLIM_INFINITY }, \
8080
[RLIMIT_NPROC] = { 0, 0 }, \
81-
[RLIMIT_NOFILE] = { INR_OPEN, INR_OPEN }, \
81+
[RLIMIT_NOFILE] = { INR_OPEN_CUR, INR_OPEN_MAX }, \
8282
[RLIMIT_MEMLOCK] = { MLOCK_LIMIT, MLOCK_LIMIT }, \
8383
[RLIMIT_AS] = { RLIM_INFINITY, RLIM_INFINITY }, \
8484
[RLIMIT_LOCKS] = { RLIM_INFINITY, RLIM_INFINITY }, \

include/linux/fs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
/* Fixed constants first: */
2525
#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 */
2728

2829
#define BLOCK_SIZE_BITS 10
2930
#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)

0 commit comments

Comments
 (0)