aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2012-05-31 19:26:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 20:49:31 -0400
commitfd1f87d24d492fda464bedf10a5dd5174ff9b065 (patch)
treefe2de6c714277ee2ea739d1bfa81a0e539f0a46a /ipc
parente6315bb154e778391ce64b194756bd3d108dadf6 (diff)
mqueue: don't use kmalloc with KMALLOC_MAX_SIZE
KMALLOC_MAX_SIZE is not a good threshold. It is extremely high and problematic. Unfortunately, some silly drivers depend on this and we can't change it. But any new code needn't use such extreme ugly high order allocations. It brings us awful fragmentation issues and system slowdown. Signed-off-by: KOSAKI Motohiro <mkosaki@jp.fujitsu.com> Acked-by: Doug Ledford <dledford@redhat.com> Acked-by: Joe Korty <joe.korty@ccur.com> Cc: Amerigo Wang <amwang@redhat.com> Cc: Serge E. Hallyn <serue@us.ibm.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Joe Korty <joe.korty@ccur.com> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index f8eba5e46c5a..6828e2c93cef 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -153,7 +153,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
153 info->attr.mq_msgsize = attr->mq_msgsize; 153 info->attr.mq_msgsize = attr->mq_msgsize;
154 } 154 }
155 mq_msg_tblsz = info->attr.mq_maxmsg * sizeof(struct msg_msg *); 155 mq_msg_tblsz = info->attr.mq_maxmsg * sizeof(struct msg_msg *);
156 if (mq_msg_tblsz > KMALLOC_MAX_SIZE) 156 if (mq_msg_tblsz > PAGE_SIZE)
157 info->messages = vmalloc(mq_msg_tblsz); 157 info->messages = vmalloc(mq_msg_tblsz);
158 else 158 else
159 info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL); 159 info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL);
@@ -266,7 +266,7 @@ static void mqueue_evict_inode(struct inode *inode)
266 spin_lock(&info->lock); 266 spin_lock(&info->lock);
267 for (i = 0; i < info->attr.mq_curmsgs; i++) 267 for (i = 0; i < info->attr.mq_curmsgs; i++)
268 free_msg(info->messages[i]); 268 free_msg(info->messages[i]);
269 if (info->attr.mq_maxmsg * sizeof(struct msg_msg *) > KMALLOC_MAX_SIZE) 269 if (is_vmalloc_addr(info->messages))
270 vfree(info->messages); 270 vfree(info->messages);
271 else 271 else
272 kfree(info->messages); 272 kfree(info->messages);