Patchwork [Lucid,master-next/ti-omap] ulimit: raise default hard ulimit on number of files to 4096

login
register
mail settings
Submitter Tim Gardner
Date Sept. 4, 2012, 1:14 p.m.
Message ID <1346764492-13917-1-git-send-email-tim.gardner@canonical.com>
Download mbox | patch
Permalink /patch/181552/
State New
Headers show

Comments

Tim Gardner - Sept. 4, 2012, 1:14 p.m.
BugLink: http://bugs.launchpad.net/bugs/663090

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>
(cherry picked from commit 0ac1ee0bfec2a4ad118f907ce586d0dfd8db7641)

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(-)
Stefan Bader - Sept. 4, 2012, 1:20 p.m.
Makes sense
Colin King - Sept. 4, 2012, 1:56 p.m.
On 04/09/12 14:14, Tim Gardner wrote:
> BugLink: http://bugs.launchpad.net/bugs/663090
>
> 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>
> (cherry picked from commit 0ac1ee0bfec2a4ad118f907ce586d0dfd8db7641)
>
> 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 1b9a47a..b1b31b3 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -21,7 +21,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)
>
Looks sane to me.

Acked-by: Colin Ian King <colin.king@canonical.com>
Herton Ronaldo Krzesinski - Sept. 4, 2012, 1:56 p.m.
Ack.

BTW, ti-omap on lucid isn't maintained anymore.
Tim Gardner - Sept. 4, 2012, 3:27 p.m.

Patch

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 1b9a47a..b1b31b3 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -21,7 +21,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)