public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Raise default hard ulimit on number of files to 4096
@ 2011-03-31 21:26 Tim Gardner
  2011-03-31 21:35 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Gardner @ 2011-03-31 21:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, Tim Gardner, Dan Kegel

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

Cc: Dan Kegel <dank@kegel.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 include/asm-generic/resource.h |    2 +-
 include/linux/fs.h             |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/resource.h b/include/asm-generic/resource.h
index 587566f..61fa862 100644
--- a/include/asm-generic/resource.h
+++ b/include/asm-generic/resource.h
@@ -78,7 +78,7 @@
 	[RLIMIT_CORE]		= {              0,  RLIM_INFINITY },	\
 	[RLIMIT_RSS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
 	[RLIMIT_NPROC]		= {              0,              0 },	\
-	[RLIMIT_NOFILE]		= {       INR_OPEN,       INR_OPEN },	\
+	[RLIMIT_NOFILE]		= {   INR_OPEN_CUR,   INR_OPEN_MAX },	\
 	[RLIMIT_MEMLOCK]	= {    MLOCK_LIMIT,    MLOCK_LIMIT },	\
 	[RLIMIT_AS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
 	[RLIMIT_LOCKS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 52f283c..6e1e4e6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -23,7 +23,8 @@
 
 /* Fixed constants first: */
 #undef NR_OPEN
-#define INR_OPEN 1024		/* Initial setting for nfile rlimits */
+#define INR_OPEN_CUR 1024	/* Initial setting for nfile rlimits */
+#define INR_OPEN_MAX 4096	/* Hard limit for nfile rlimits */
 
 #define BLOCK_SIZE_BITS 10
 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Raise default hard ulimit on number of files to 4096
  2011-03-31 21:26 [PATCH] Raise default hard ulimit on number of files to 4096 Tim Gardner
@ 2011-03-31 21:35 ` Andrew Morton
  2011-04-01  1:30   ` [PATCH V2] " Tim Gardner
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2011-03-31 21:35 UTC (permalink / raw)
  To: Tim Gardner; +Cc: linux-kernel, Dan Kegel

On Thu, 31 Mar 2011 15:26:50 -0600
Tim Gardner <tim.gardner@canonical.com> wrote:

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

^^ how not to write a changelog.

Here's the useful part, from Dan's bugzilla report:

: 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 for 11.04 by changing include/asm-generic/resource.h:
: 
: -    [RLIMIT_NOFILE]        = {       INR_OPEN,       INR_OPEN },    \
: +    [RLIMIT_NOFILE]        = {       INR_OPEN,     INR_OPEN*4 },    \
: 
: They chose to do 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.


> ---
>  include/asm-generic/resource.h |    2 +-
>  include/linux/fs.h             |    3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/asm-generic/resource.h b/include/asm-generic/resource.h
> index 587566f..61fa862 100644
> --- a/include/asm-generic/resource.h
> +++ b/include/asm-generic/resource.h
> @@ -78,7 +78,7 @@
>  	[RLIMIT_CORE]		= {              0,  RLIM_INFINITY },	\
>  	[RLIMIT_RSS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
>  	[RLIMIT_NPROC]		= {              0,              0 },	\
> -	[RLIMIT_NOFILE]		= {       INR_OPEN,       INR_OPEN },	\
> +	[RLIMIT_NOFILE]		= {   INR_OPEN_CUR,   INR_OPEN_MAX },	\
>  	[RLIMIT_MEMLOCK]	= {    MLOCK_LIMIT,    MLOCK_LIMIT },	\
>  	[RLIMIT_AS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
>  	[RLIMIT_LOCKS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 52f283c..6e1e4e6 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -23,7 +23,8 @@
>  
>  /* Fixed constants first: */
>  #undef NR_OPEN
> -#define INR_OPEN 1024		/* Initial setting for nfile rlimits */
> +#define INR_OPEN_CUR 1024	/* Initial setting for nfile rlimits */
> +#define INR_OPEN_MAX 4096	/* Hard limit for nfile rlimits */
>  
>  #define BLOCK_SIZE_BITS 10
>  #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
> -- 
> 1.7.0.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] Raise default hard ulimit on number of files to 4096
  2011-03-31 21:35 ` Andrew Morton
@ 2011-04-01  1:30   ` Tim Gardner
  2011-04-01  4:13     ` Dan Kegel
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Gardner @ 2011-04-01  1:30 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Dan Kegel

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

On 03/31/2011 03:35 PM, Andrew Morton wrote:
>
> ^^ how not to write a changelog.
>

It seemed like plagiarism to just copy Dan's argument, but now here you 
have it.

rtg
-- 
Tim Gardner tim.gardner@canonical.com

[-- Attachment #2: 0001-Raise-default-hard-ulimit-on-number-of-files-to-4096.patch --]
[-- Type: text/x-patch, Size: 2317 bytes --]

>From 819066637c964290fbab058b578dadbb31ae4235 Mon Sep 17 00:00:00 2001
From: Tim Gardner <tim.gardner@canonical.com>
Date: Thu, 31 Mar 2011 15:07:48 -0600
Subject: [PATCH] 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.

Cc: Dan Kegel <dank@kegel.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 include/asm-generic/resource.h |    2 +-
 include/linux/fs.h             |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/resource.h b/include/asm-generic/resource.h
index 587566f..61fa862 100644
--- a/include/asm-generic/resource.h
+++ b/include/asm-generic/resource.h
@@ -78,7 +78,7 @@
 	[RLIMIT_CORE]		= {              0,  RLIM_INFINITY },	\
 	[RLIMIT_RSS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
 	[RLIMIT_NPROC]		= {              0,              0 },	\
-	[RLIMIT_NOFILE]		= {       INR_OPEN,       INR_OPEN },	\
+	[RLIMIT_NOFILE]		= {   INR_OPEN_CUR,   INR_OPEN_MAX },	\
 	[RLIMIT_MEMLOCK]	= {    MLOCK_LIMIT,    MLOCK_LIMIT },	\
 	[RLIMIT_AS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
 	[RLIMIT_LOCKS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 52f283c..6e1e4e6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -23,7 +23,8 @@
 
 /* Fixed constants first: */
 #undef NR_OPEN
-#define INR_OPEN 1024		/* Initial setting for nfile rlimits */
+#define INR_OPEN_CUR 1024	/* Initial setting for nfile rlimits */
+#define INR_OPEN_MAX 4096	/* Hard limit for nfile rlimits */
 
 #define BLOCK_SIZE_BITS 10
 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] Raise default hard ulimit on number of files to 4096
  2011-04-01  1:30   ` [PATCH V2] " Tim Gardner
@ 2011-04-01  4:13     ` Dan Kegel
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Kegel @ 2011-04-01  4:13 UTC (permalink / raw)
  To: tim.gardner; +Cc: Andrew Morton, linux-kernel

On Fri, Apr 1, 2011 at 1:30 AM, Tim Gardner <tim.gardner@canonical.com> wrote:
> On 03/31/2011 03:35 PM, Andrew Morton wrote:
>>
>> ^^ how not to write a changelog.
>
> It seemed like plagiarism to just copy Dan's argument, but now here you have
> it.

I don't mind one bit.  Very happy to see this change going in.
- Dan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-01  4:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-31 21:26 [PATCH] Raise default hard ulimit on number of files to 4096 Tim Gardner
2011-03-31 21:35 ` Andrew Morton
2011-04-01  1:30   ` [PATCH V2] " Tim Gardner
2011-04-01  4:13     ` Dan Kegel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox