aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/mqueue.c
diff options
context:
space:
mode:
authorJoe Korty <joe.korty@ccur.com>2008-10-18 23:28:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 11:52:40 -0400
commitb231cca4381ee15ec99afbfb244fbc0324869927 (patch)
tree1539fb250a15e6098c1e2ff4c98b166e5f6f1e3a /ipc/mqueue.c
parentacd99dbf54020f5c80b9aa2f2ea86f43cb285b02 (diff)
message queues: increase range limits
Increase the range of various posix message queue limits. Posix gives the message queue user the ability to 'trade off' the maximum size of messages with the number of possible messages that can be 'in flight'. Linux currently makes this trade off more restrictive than it needs to be. In particular, the maximum message size today can be made no smaller than 8192. This greatly restricts those applications that would like to have the ability to post large numbers of very small messages. So this task lowers the limit that the maximum message size can be set to, from 8192 to 128. It also lowers the limit that the maximum #number of messages in flight can be set to, from 10 to 1. With these changes the message queue user can make better trade offs between #messages and message size, in order to get everything to fit within the setrlimit(RLIMIT_MSGQUEUE) limit for that particular user. This patch also applies the values in /proc/sys/fs/mqueue/msg_max /proc/sys/fs/mqueue/msgsize_max as the defaults for the max #messages allowed and the max message size allowed, respectively, for those applications that do not supply these. Previously, the defaults were hardwired to 10 and 8192, respectively. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Joe Korty <joe.korty@ccur.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Nadia Derbey <Nadia.Derbey@bull.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/mqueue.c')
-rw-r--r--ipc/mqueue.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 96fb36cd9874..68eb857cfdea 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -52,6 +52,14 @@
52#define HARD_MSGMAX (131072/sizeof(void*)) 52#define HARD_MSGMAX (131072/sizeof(void*))
53#define DFLT_MSGSIZEMAX 8192 /* max message size */ 53#define DFLT_MSGSIZEMAX 8192 /* max message size */
54 54
55/*
56 * Define the ranges various user-specified maximum values can
57 * be set to.
58 */
59#define MIN_MSGMAX 1 /* min value for msg_max */
60#define MAX_MSGMAX HARD_MSGMAX /* max value for msg_max */
61#define MIN_MSGSIZEMAX 128 /* min value for msgsize_max */
62#define MAX_MSGSIZEMAX (8192*128) /* max value for msgsize_max */
55 63
56struct ext_wait_queue { /* queue of sleeping tasks */ 64struct ext_wait_queue { /* queue of sleeping tasks */
57 struct task_struct *task; 65 struct task_struct *task;
@@ -134,8 +142,8 @@ static struct inode *mqueue_get_inode(struct super_block *sb, int mode,
134 info->qsize = 0; 142 info->qsize = 0;
135 info->user = NULL; /* set when all is ok */ 143 info->user = NULL; /* set when all is ok */
136 memset(&info->attr, 0, sizeof(info->attr)); 144 memset(&info->attr, 0, sizeof(info->attr));
137 info->attr.mq_maxmsg = DFLT_MSGMAX; 145 info->attr.mq_maxmsg = msg_max;
138 info->attr.mq_msgsize = DFLT_MSGSIZEMAX; 146 info->attr.mq_msgsize = msgsize_max;
139 if (attr) { 147 if (attr) {
140 info->attr.mq_maxmsg = attr->mq_maxmsg; 148 info->attr.mq_maxmsg = attr->mq_maxmsg;
141 info->attr.mq_msgsize = attr->mq_msgsize; 149 info->attr.mq_msgsize = attr->mq_msgsize;
@@ -1191,11 +1199,11 @@ static struct file_system_type mqueue_fs_type = {
1191 .kill_sb = kill_litter_super, 1199 .kill_sb = kill_litter_super,
1192}; 1200};
1193 1201
1194static int msg_max_limit_min = DFLT_MSGMAX; 1202static int msg_max_limit_min = MIN_MSGMAX;
1195static int msg_max_limit_max = HARD_MSGMAX; 1203static int msg_max_limit_max = MAX_MSGMAX;
1196 1204
1197static int msg_maxsize_limit_min = DFLT_MSGSIZEMAX; 1205static int msg_maxsize_limit_min = MIN_MSGSIZEMAX;
1198static int msg_maxsize_limit_max = INT_MAX; 1206static int msg_maxsize_limit_max = MAX_MSGSIZEMAX;
1199 1207
1200static ctl_table mq_sysctls[] = { 1208static ctl_table mq_sysctls[] = {
1201 { 1209 {