]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mqueue: don't use kmalloc with KMALLOC_MAX_SIZE
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Wed, 25 Apr 2012 01:04:48 +0000 (11:04 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 30 Apr 2012 05:17:41 +0000 (15:17 +1000)
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>
ipc/mqueue.c

index 3ced596c1b3be75caf36eeed4a5961935a5feaa0..f9f0782fc8de02541462898b85e5119948c73874 100644 (file)
@@ -150,7 +150,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
                        info->attr.mq_msgsize = attr->mq_msgsize;
                }
                mq_msg_tblsz = info->attr.mq_maxmsg * sizeof(struct msg_msg *);
-               if (mq_msg_tblsz > KMALLOC_MAX_SIZE)
+               if (mq_msg_tblsz > PAGE_SIZE)
                        info->messages = vmalloc(mq_msg_tblsz);
                else
                        info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL);
@@ -263,7 +263,7 @@ static void mqueue_evict_inode(struct inode *inode)
        spin_lock(&info->lock);
        for (i = 0; i < info->attr.mq_curmsgs; i++)
                free_msg(info->messages[i]);
-       if (info->attr.mq_maxmsg * sizeof(struct msg_msg *) > KMALLOC_MAX_SIZE)
+       if (is_vmalloc_addr(info->messages))
                vfree(info->messages);
        else
                kfree(info->messages);