From patchwork Mon Mar 3 08:00:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Yalin" X-Patchwork-Id: 3752001 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22AB6BF13A for ; Mon, 3 Mar 2014 08:01:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F402E20255 for ; Mon, 3 Mar 2014 08:01:51 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 26DFE201F4 for ; Mon, 3 Mar 2014 08:01:50 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKNol-0007c1-Rc; Mon, 03 Mar 2014 08:01:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKNoj-0006Ad-Fm; Mon, 03 Mar 2014 08:01:41 +0000 Received: from cnbjrel01.sonyericsson.com ([219.141.167.165]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKNog-00069V-Ba for linux-arm-kernel@lists.infradead.org; Mon, 03 Mar 2014 08:01:39 +0000 From: "Wang, Yalin" To: "'gregkh@linuxfoundation.org'" Date: Mon, 3 Mar 2014 16:00:59 +0800 Subject: RE: change kmalloc into vmalloc for large memory allocations Thread-Topic: change kmalloc into vmalloc for large memory allocations Thread-Index: Ac82jdSXmB/40HdmRzSAMQzY4c9gQgAJzh1w Message-ID: <35FD53F367049845BC99AC72306C23D102844605F390@CNBJMBX05.corpusers.net> References: <35FD53F367049845BC99AC72306C23D102844605F38C@CNBJMBX05.corpusers.net> <53104ECA.4010702@freescale.com> <35FD53F367049845BC99AC72306C23D102844605F38D@CNBJMBX05.corpusers.net> <20140228163304.GA15614@kroah.com> <35FD53F367049845BC99AC72306C23D102844605F38F@CNBJMBX05.corpusers.net> <20140303030821.GA16732@kroah.com> In-Reply-To: <20140303030821.GA16732@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140303_030138_693197_FF193717 X-CRM114-Status: GOOD ( 14.88 ) X-Spam-Score: -4.2 (----) Cc: "'alsa-devel@alsa-project.org'" , "'broonie@opensource.wolfsonmicro.com'" , "'tiwai@suse.de'" , "'fweisbec@gmail.com'" , 'Will Deacon' , "'perex@perex.cz'" , "'mingo@redhat.com'" , "'linux-input@vger.kernel.org'" , "'rydberg@euromail.se'" , "'lrg@ti.com'" , "'pablo@netfilter.org'" , "'rusty@rustcorp.com.au'" , "'coreteam@netfilter.org'" , "'linux-arm-msm@vger.kernel.org'" , "'mschmidt@redhat.com'" , "'rostedt@goodmis.org'" , "'netfilter@vger.kernel.org'" , "'linux-arm-kernel@lists.infradead.org'" , "'laforge@netfilter.org'" , "'netdev@vger.kernel.org'" , "'dmitry.torokhov@gmail.com'" , "'zhaojingmin@users.sourceforge.net'" , "'linux-kernel@vger.kernel.org'" , "'balbi@ti.com'" , "'davem@davemloft.net'" , 'Huang Shijie' , "'linux-usb@vger.kernel.org'" , "'netfilter-devel@vger.kernel.org'" , "'kaber@trash.net'" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi greg, For https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/drivers/input/evdev.c?h=master#n403 there have been a patch for kmalloc failed , for https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/sound/soc/soc-core.c?h=master#n3772 I have not change it , need some more code to change in devm_kzalloc .. I make a patch for netfilter part : https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/netfilter/nf_conntrack_ftp.c?h=master#n603 https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/netfilter/nf_conntrack_h323_main.c?h=master#n1849 https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/netfilter/nf_conntrack_irc.c?h=master#n247 https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/netfilter/nf_conntrack_sane.c?h=master#n195 seems work well , these module will allocate 64KB large memory, is it possible to be merged ? Thanks -- >8 -- -----Original Message----- From: 'gregkh@linuxfoundation.org' [mailto:gregkh@linuxfoundation.org] Sent: Monday, March 03, 2014 11:08 AM To: Wang, Yalin Cc: 'Huang Shijie'; 'linux-kernel@vger.kernel.org'; 'linux-arm-msm@vger.kernel.org'; 'linux-arm-kernel@lists.infradead.org'; 'linux-input@vger.kernel.org'; 'balbi@ti.com'; 'lrg@ti.com'; 'broonie@opensource.wolfsonmicro.com'; 'perex@perex.cz'; 'tiwai@suse.de'; 'pablo@netfilter.org'; 'kaber@trash.net'; 'davem@davemloft.net'; 'rostedt@goodmis.org'; 'fweisbec@gmail.com'; 'mingo@redhat.com'; 'dmitry.torokhov@gmail.com'; 'rydberg@euromail.se'; 'linux-usb@vger.kernel.org'; 'alsa-devel@alsa-project.org'; 'netfilter-devel@vger.kernel.org'; 'netfilter@vger.kernel.org'; 'coreteam@netfilter.org'; 'netdev@vger.kernel.org' Subject: Re: change kmalloc into vmalloc for large memory allocations On Mon, Mar 03, 2014 at 10:51:23AM +0800, Wang, Yalin wrote: > Hi greg, > > I am sorry, > I make a mistake , > You are right , > https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/drive > rs/usb/gadget/f_mass_storage.c?h=master#n2724 > > this one should not changed to use vmalloc, the buffer will be used by > DMA? Which is why a wrapper function will never work. > others should be safe to change: > > https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/sound > /soc/soc-core.c?h=master#n3772 > > https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/n > etfilter/nf_conntrack_ftp.c?h=master#n603 > https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/n > etfilter/nf_conntrack_h323_main.c?h=master#n1849 > https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/n > etfilter/nf_conntrack_irc.c?h=master#n247 > https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/n > etfilter/nf_conntrack_sane.c?h=master#n195 > > https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/drive > rs/input/evdev.c?h=master#n403 Then send individual patches for these and see what happens. greg k-h diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c index b8a0924..0e92b0d 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -593,14 +593,14 @@ static void nf_conntrack_ftp_fini(void) } } - kfree(ftp_buffer); + vfree(ftp_buffer); } static int __init nf_conntrack_ftp_init(void) { int i, j = -1, ret = 0; - ftp_buffer = kmalloc(65536, GFP_KERNEL); + ftp_buffer = vmalloc(65536, GFP_KERNEL); if (!ftp_buffer) return -ENOMEM; diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c index 70866d1..49ae092 100644 --- a/net/netfilter/nf_conntrack_h323_main.c +++ b/net/netfilter/nf_conntrack_h323_main.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -1837,7 +1837,7 @@ static void __exit nf_conntrack_h323_fini(void) nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); - kfree(h323_buffer); + vfree(h323_buffer); pr_debug("nf_ct_h323: fini\n"); } @@ -1846,7 +1846,7 @@ static int __init nf_conntrack_h323_init(void) { int ret; - h323_buffer = kmalloc(65536, GFP_KERNEL); + h323_buffer = vmalloc(65536, GFP_KERNEL); if (!h323_buffer) return -ENOMEM; ret = nf_conntrack_helper_register(&nf_conntrack_helper_h245); @@ -1876,7 +1876,7 @@ err3: err2: nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); err1: - kfree(h323_buffer); + vfree(h323_buffer); return ret; } diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_irc.c index 0fd2976..b57df10 100644 --- a/net/netfilter/nf_conntrack_irc.c +++ b/net/netfilter/nf_conntrack_irc.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include @@ -244,7 +244,7 @@ static int __init nf_conntrack_irc_init(void) irc_exp_policy.max_expected = max_dcc_channels; irc_exp_policy.timeout = dcc_timeout; - irc_buffer = kmalloc(65536, GFP_KERNEL); + irc_buffer = vmalloc(65536); if (!irc_buffer) return -ENOMEM; @@ -285,7 +285,7 @@ static void nf_conntrack_irc_fini(void) for (i = 0; i < ports_c; i++) nf_conntrack_helper_unregister(&irc[i]); - kfree(irc_buffer); + vfree(irc_buffer); } module_init(nf_conntrack_irc_init); diff --git a/net/netfilter/nf_conntrack_sane.c b/net/netfilter/nf_conntrack_sane.c index 4a2134f..a4c8bf3 100644 --- a/net/netfilter/nf_conntrack_sane.c +++ b/net/netfilter/nf_conntrack_sane.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -185,14 +185,14 @@ static void nf_conntrack_sane_fini(void) } } - kfree(sane_buffer); + vfree(sane_buffer); } static int __init nf_conntrack_sane_init(void) { int i, j = -1, ret = 0; - sane_buffer = kmalloc(65536, GFP_KERNEL); + sane_buffer = vmalloc(65536); if (!sane_buffer) return -ENOMEM;