* [PATCH] cgroup: Avoid a memset by using vzalloc @ 2010-10-30 21:35 Jesper Juhl 2010-10-30 23:34 ` Minchan Kim 2010-11-01 22:00 ` Paul Menage 0 siblings, 2 replies; 14+ messages in thread From: Jesper Juhl @ 2010-10-30 21:35 UTC (permalink / raw) To: linux-kernel; +Cc: linux-mm, Paul Menage, Li Zefan, containers Hi, We can avoid doing a memset in swap_cgroup_swapon() by using vzalloc(). Signed-off-by: Jesper Juhl <jj@chaosbits.net> --- compile tested only. page_cgroup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c index 5bffada..34970c7 100644 --- a/mm/page_cgroup.c +++ b/mm/page_cgroup.c @@ -450,11 +450,10 @@ int swap_cgroup_swapon(int type, unsigned long max_pages) length = ((max_pages/SC_PER_PAGE) + 1); array_size = length * sizeof(void *); - array = vmalloc(array_size); + array = vzalloc(array_size); if (!array) goto nomem; - memset(array, 0, array_size); ctrl = &swap_cgroup_ctrl[type]; mutex_lock(&swap_cgroup_mutex); ctrl->length = length; -- Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/ Plain text mails only, please http://www.expita.com/nomime.html Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-10-30 21:35 [PATCH] cgroup: Avoid a memset by using vzalloc Jesper Juhl @ 2010-10-30 23:34 ` Minchan Kim 2010-10-31 17:33 ` Balbir Singh 2010-11-01 22:00 ` Paul Menage 1 sibling, 1 reply; 14+ messages in thread From: Minchan Kim @ 2010-10-30 23:34 UTC (permalink / raw) To: Jesper Juhl; +Cc: linux-kernel, linux-mm, Paul Menage, Li Zefan, containers On Sun, Oct 31, 2010 at 6:35 AM, Jesper Juhl <jj@chaosbits.net> wrote: > Hi, > > We can avoid doing a memset in swap_cgroup_swapon() by using vzalloc(). > > > Signed-off-by: Jesper Juhl <jj@chaosbits.net> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> There are so many placed need vzalloc. Thanks, Jesper. -- Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-10-30 23:34 ` Minchan Kim @ 2010-10-31 17:33 ` Balbir Singh 2010-11-01 5:40 ` Jesper Juhl 0 siblings, 1 reply; 14+ messages in thread From: Balbir Singh @ 2010-10-31 17:33 UTC (permalink / raw) To: Minchan Kim Cc: Jesper Juhl, linux-kernel, linux-mm, Paul Menage, Li Zefan, containers * MinChan Kim <minchan.kim@gmail.com> [2010-10-31 08:34:01]: > On Sun, Oct 31, 2010 at 6:35 AM, Jesper Juhl <jj@chaosbits.net> wrote: > > Hi, > > > > We can avoid doing a memset in swap_cgroup_swapon() by using vzalloc(). > > > > > > Signed-off-by: Jesper Juhl <jj@chaosbits.net> > Reviewed-by: Minchan Kim <minchan.kim@gmail.com> > > There are so many placed need vzalloc. > Thanks, Jesper. Yes, please check memcontrol.c as well Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> -- Three Cheers, Balbir -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-10-31 17:33 ` Balbir Singh @ 2010-11-01 5:40 ` Jesper Juhl 2010-11-03 14:38 ` Christoph Lameter 0 siblings, 1 reply; 14+ messages in thread From: Jesper Juhl @ 2010-11-01 5:40 UTC (permalink / raw) To: Balbir Singh Cc: Minchan Kim, linux-kernel, linux-mm, Paul Menage, Li Zefan, containers On Sun, 31 Oct 2010, Balbir Singh wrote: > * MinChan Kim <minchan.kim@gmail.com> [2010-10-31 08:34:01]: > > > On Sun, Oct 31, 2010 at 6:35 AM, Jesper Juhl <jj@chaosbits.net> wrote: > > > Hi, > > > > > > We can avoid doing a memset in swap_cgroup_swapon() by using vzalloc(). > > > > > > > > > Signed-off-by: Jesper Juhl <jj@chaosbits.net> > > Reviewed-by: Minchan Kim <minchan.kim@gmail.com> > > > > There are so many placed need vzalloc. > > Thanks, Jesper. > > Yes, please check memcontrol.c as well > I will shortly, I'm slowly working my way through a mountain of code checking for this. I'll get to memcontrol.c > > Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> > Thanks. -- Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/ Plain text mails only, please http://www.expita.com/nomime.html Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-11-01 5:40 ` Jesper Juhl @ 2010-11-03 14:38 ` Christoph Lameter 2010-11-03 15:20 ` jovi zhang 0 siblings, 1 reply; 14+ messages in thread From: Christoph Lameter @ 2010-11-03 14:38 UTC (permalink / raw) To: Jesper Juhl Cc: Balbir Singh, Minchan Kim, linux-kernel, linux-mm, Paul Menage, Li Zefan, containers On Mon, 1 Nov 2010, Jesper Juhl wrote: > On Sun, 31 Oct 2010, Balbir Singh wrote: > > > There are so many placed need vzalloc. > > > Thanks, Jesper. Could we avoid this painful exercise with a "semantic patch"? -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-11-03 14:38 ` Christoph Lameter @ 2010-11-03 15:20 ` jovi zhang 2010-11-03 15:31 ` Christoph Lameter ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: jovi zhang @ 2010-11-03 15:20 UTC (permalink / raw) To: Christoph Lameter Cc: Jesper Juhl, Balbir Singh, Minchan Kim, linux-kernel, linux-mm, Paul Menage, Li Zefan, containers On Wed, Nov 3, 2010 at 10:38 PM, Christoph Lameter <cl@linux.com> wrote: > On Mon, 1 Nov 2010, Jesper Juhl wrote: > >> On Sun, 31 Oct 2010, Balbir Singh wrote: > >> > > There are so many placed need vzalloc. >> > > Thanks, Jesper. > > > Could we avoid this painful exercise with a "semantic patch"? > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > Can we make a grep script to walk all files to find vzalloc usage like this? No need to send patch mail one by one like this. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-11-03 15:20 ` jovi zhang @ 2010-11-03 15:31 ` Christoph Lameter 2010-11-03 15:48 ` Joe Perches 2010-11-03 16:37 ` [PATCH] cgroup: Avoid a memset by using vzalloc Américo Wang 2 siblings, 0 replies; 14+ messages in thread From: Christoph Lameter @ 2010-11-03 15:31 UTC (permalink / raw) To: jovi zhang Cc: Jesper Juhl, Balbir Singh, Minchan Kim, linux-kernel, linux-mm, Paul Menage, Li Zefan, containers On Wed, 3 Nov 2010, jovi zhang wrote: > On Wed, Nov 3, 2010 at 10:38 PM, Christoph Lameter <cl@linux.com> wrote: > > Could we avoid this painful exercise with a "semantic patch"? > Can we make a grep script to walk all files to find vzalloc usage like this? > No need to send patch mail one by one like this. Please use spatch. See http://lwn.net/Articles/315686/ -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-11-03 15:20 ` jovi zhang 2010-11-03 15:31 ` Christoph Lameter @ 2010-11-03 15:48 ` Joe Perches 2010-11-03 16:10 ` Christoph Lameter 2010-11-03 16:37 ` [PATCH] cgroup: Avoid a memset by using vzalloc Américo Wang 2 siblings, 1 reply; 14+ messages in thread From: Joe Perches @ 2010-11-03 15:48 UTC (permalink / raw) To: jovi zhang Cc: Christoph Lameter, Jesper Juhl, Balbir Singh, Minchan Kim, linux-kernel, linux-mm, Paul Menage, Li Zefan, containers On Wed, 2010-11-03 at 23:20 +0800, jovi zhang wrote: > On Wed, Nov 3, 2010 at 10:38 PM, Christoph Lameter <cl@linux.com> wrote: > > On Mon, 1 Nov 2010, Jesper Juhl wrote: > > > >> On Sun, 31 Oct 2010, Balbir Singh wrote: > > > >> > > There are so many placed need vzalloc. > >> > > Thanks, Jesper. > > > > > > Could we avoid this painful exercise with a "semantic patch"? There's an existing cocci kmalloc/memset script. Perhaps this is good enough? cp scripts/coccinelle/api/alloc/kzalloc-simple.cocci scripts/coccinelle/api/alloc/vzalloc-simple.cocci sed -i -e 's/kmalloc/vmalloc/g' -e 's/kzalloc/vzalloc/g' scripts/coccinelle/api/alloc/vzalloc-simple.cocci -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-11-03 15:48 ` Joe Perches @ 2010-11-03 16:10 ` Christoph Lameter 2010-11-04 21:43 ` Jesper Juhl 2010-11-05 3:07 ` [PATCH 00/49] Use vzalloc not vmalloc/kmemset Joe Perches 0 siblings, 2 replies; 14+ messages in thread From: Christoph Lameter @ 2010-11-03 16:10 UTC (permalink / raw) To: Joe Perches Cc: jovi zhang, Jesper Juhl, Balbir Singh, Minchan Kim, linux-kernel, linux-mm, Paul Menage, Li Zefan, containers On Wed, 3 Nov 2010, Joe Perches wrote: > On Wed, 2010-11-03 at 23:20 +0800, jovi zhang wrote: > > On Wed, Nov 3, 2010 at 10:38 PM, Christoph Lameter <cl@linux.com> wrote: > > > On Mon, 1 Nov 2010, Jesper Juhl wrote: > > > > > >> On Sun, 31 Oct 2010, Balbir Singh wrote: > > > > > >> > > There are so many placed need vzalloc. > > >> > > Thanks, Jesper. > > > > > > > > > Could we avoid this painful exercise with a "semantic patch"? > > There's an existing cocci kmalloc/memset script. I have it in /usr/share/doc/coccinelle/examples/janitorings/kzalloc-orig.cocci.gz (Ubuntu coccinelle package) > Perhaps this is good enough? > > cp scripts/coccinelle/api/alloc/kzalloc-simple.cocci scripts/coccinelle/api/alloc/vzalloc-simple.cocci > sed -i -e 's/kmalloc/vmalloc/g' -e 's/kzalloc/vzalloc/g' scripts/coccinelle/api/alloc/vzalloc-simple.cocci Not sure if that is the same script but certainly a good start. Try it and see if it catches all the locations that you know of? -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-11-03 16:10 ` Christoph Lameter @ 2010-11-04 21:43 ` Jesper Juhl 2010-11-05 3:07 ` [PATCH 00/49] Use vzalloc not vmalloc/kmemset Joe Perches 1 sibling, 0 replies; 14+ messages in thread From: Jesper Juhl @ 2010-11-04 21:43 UTC (permalink / raw) To: Christoph Lameter Cc: Joe Perches, jovi zhang, Balbir Singh, Minchan Kim, linux-kernel, linux-mm, Paul Menage, Li Zefan, containers On Wed, 3 Nov 2010, Christoph Lameter wrote: > On Wed, 3 Nov 2010, Joe Perches wrote: > > > On Wed, 2010-11-03 at 23:20 +0800, jovi zhang wrote: > > > On Wed, Nov 3, 2010 at 10:38 PM, Christoph Lameter <cl@linux.com> wrote: > > > > On Mon, 1 Nov 2010, Jesper Juhl wrote: > > > > > > > >> On Sun, 31 Oct 2010, Balbir Singh wrote: > > > > > > > >> > > There are so many placed need vzalloc. > > > >> > > Thanks, Jesper. > > > > > > > > > > > > Could we avoid this painful exercise with a "semantic patch"? > > > > There's an existing cocci kmalloc/memset script. > > I have it in > /usr/share/doc/coccinelle/examples/janitorings/kzalloc-orig.cocci.gz > > (Ubuntu coccinelle package) > > > Perhaps this is good enough? > > > > cp scripts/coccinelle/api/alloc/kzalloc-simple.cocci scripts/coccinelle/api/alloc/vzalloc-simple.cocci > > sed -i -e 's/kmalloc/vmalloc/g' -e 's/kzalloc/vzalloc/g' scripts/coccinelle/api/alloc/vzalloc-simple.cocci > > Not sure if that is the same script but certainly a good start. Try it and > see if it catches all the locations that you know of? > I'm aware of coccinelle, but I've never used it and it looks like it'll take more than just a few hours to learn, so I'm sticking with bash+egrep+manual inspection for now until I get a bit more time on my hands to learn coccinelle/spatch. I assume that not using spatch is not going to be an obstacle to patches such as this one getting merged...? -- Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/ Plain text mails only, please http://www.expita.com/nomime.html Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 00/49] Use vzalloc not vmalloc/kmemset 2010-11-03 16:10 ` Christoph Lameter 2010-11-04 21:43 ` Jesper Juhl @ 2010-11-05 3:07 ` Joe Perches 2010-11-05 3:08 ` [PATCH 44/49] mm: Use vzalloc Joe Perches 1 sibling, 1 reply; 14+ messages in thread From: Joe Perches @ 2010-11-05 3:07 UTC (permalink / raw) To: Jiri Kosina Cc: linux-ia64, linux-kernel, linux-mips, kvm, kvm-ppc, linuxppc-dev, cbe-oss-dev, linux-s390, amd64-microcode, linux-crypto, linux-atm-general, netdev, drbd-user, dri-devel, linux-input, linux-rdma, dm-devel, linux-raid, linux-media, linux-mtd, e1000-devel, linux-scsi, osst-users, devel, xen-devel, virtualization, linux-ext4, reiserfs-devel, xfs, codalist, linux-mm, containers, netfilter-devel, netfilter, coreteam, rds-devel, alsa-devel Converted vmalloc/memset and vmalloc_node/memset to vzalloc or vzalloc_node using a cocci script and some editing Reduces text a little bit. Compiled x86 only. There are still vmalloc_32 with memset calls still around. Broken out to multiple patches to cc appropriate maintainers. Joe Perches (49): arch/ia64: Use vzalloc arch/mips: Use vzalloc arch/powerpc: Use vzalloc arch/s390: Use vzalloc arch/x86: Use vzalloc crypto: Use vzalloc drivers/atm: Use vzalloc drivers/block: Use vzalloc drivers/char: Use vzalloc drivers/gpu: Use vzalloc drivers/hid: Use vzalloc drivers/infiniband: Use vzalloc drivers/isdn: Use vzalloc drivers/md: Use vzalloc drivers/media: Use vzalloc drivers/mtd: Use vzalloc drivers/net/cxgb3: Use vzalloc drivers/net/cxgb4: Use vzalloc drivers/net/e1000: Use vzalloc drivers/net/e1000e: Use vzalloc drivers/net/ehea: Use vzalloc drivers/net/igb: Use vzalloc drivers/net/igbvf: Use vzalloc drivers/net/ixgb: Use vzalloc drivers/net/ixgbe: Use vzalloc drivers/net/ixgbevf: Use vzalloc drivers/net/netxen: Use vzalloc drivers/net/pch_gbe: Use vzalloc drivers/net/qlcnic: Use vzalloc drivers/net/sfc: Use vzalloc drivers/net/vxge: Use vzalloc drivers/net/bnx2.c: Use vzalloc drivers/s390: Use vzalloc drivers/scsi: Use vzalloc drivers/staging: Use vzalloc drivers/video: Use vzalloc fs/ext4: Use vzalloc fs/jffs2: Use vzalloc fs/reiserfs: Use vzalloc fs/udf: Use vzalloc fs/xfs: Use vzalloc include/linux/coda_linux.h: Use vzalloc kernel: Use vzalloc mm: Use vzalloc net/core/pktgen.c: Use vzalloc net/netfilter: Use vzalloc net/rds: Use vzalloc sound/oss/dev_table.c: Use vzalloc virt/kvm/kvm_main.c: Use vzalloc arch/ia64/kernel/perfmon.c | 3 +- arch/mips/sibyte/common/sb_tbprof.c | 3 +- arch/powerpc/kvm/book3s.c | 6 +-- arch/powerpc/platforms/cell/spufs/lscsa_alloc.c | 3 +- arch/s390/hypfs/hypfs_diag.c | 3 +- arch/x86/kernel/microcode_amd.c | 3 +- arch/x86/kvm/x86.c | 3 +- arch/x86/mm/pageattr-test.c | 3 +- crypto/deflate.c | 3 +- crypto/zlib.c | 3 +- drivers/atm/idt77252.c | 11 ++++--- drivers/atm/lanai.c | 3 +- drivers/block/drbd/drbd_bitmap.c | 5 +-- drivers/char/agp/backend.c | 3 +- drivers/char/mspec.c | 5 +-- drivers/gpu/drm/via/via_dmablit.c | 4 +- drivers/hid/hid-core.c | 3 +- drivers/infiniband/hw/amso1100/c2_rnic.c | 5 +-- drivers/infiniband/hw/ehca/ipz_pt_fn.c | 5 +-- drivers/infiniband/hw/ipath/ipath_driver.c | 3 +- drivers/infiniband/hw/ipath/ipath_file_ops.c | 11 ++----- drivers/infiniband/hw/ipath/ipath_init_chip.c | 5 +-- drivers/infiniband/hw/qib/qib_init.c | 7 +--- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 10 ++---- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +- drivers/isdn/i4l/isdn_common.c | 4 +- drivers/isdn/mISDN/dsp_core.c | 3 +- drivers/isdn/mISDN/l1oip_codec.c | 6 +-- drivers/md/dm-log.c | 3 +- drivers/md/dm-snap-persistent.c | 3 +- drivers/md/dm-table.c | 4 +-- drivers/media/dvb/ngene/ngene-core.c | 3 +- drivers/media/video/mx3_camera.c | 3 +- drivers/media/video/pwc/pwc-if.c | 3 +- drivers/media/video/videobuf-dma-sg.c | 3 +- drivers/mtd/nand/nandsim.c | 3 +- drivers/mtd/ubi/vtbl.c | 6 +-- drivers/net/bnx2.c | 10 +----- drivers/net/cxgb3/cxgb3_offload.c | 7 ++-- drivers/net/cxgb4/cxgb4_main.c | 7 ++-- drivers/net/e1000/e1000_main.c | 6 +-- drivers/net/e1000e/netdev.c | 6 +-- drivers/net/ehea/ehea_main.c | 4 +-- drivers/net/igb/igb_main.c | 6 +-- drivers/net/igbvf/netdev.c | 6 +-- drivers/net/ixgb/ixgb_main.c | 6 +-- drivers/net/ixgbe/ixgbe_main.c | 10 ++---- drivers/net/ixgbevf/ixgbevf_main.c | 6 +-- drivers/net/netxen/netxen_nic_init.c | 7 +--- drivers/net/pch_gbe/pch_gbe_main.c | 6 +-- drivers/net/qlcnic/qlcnic_init.c | 7 +--- drivers/net/sfc/filter.c | 3 +- drivers/net/vxge/vxge-config.c | 37 +++++----------------- drivers/s390/cio/blacklist.c | 3 +- drivers/scsi/bfa/bfad.c | 3 +- drivers/scsi/bfa/bfad_debugfs.c | 8 +---- drivers/scsi/cxgbi/libcxgbi.h | 9 ++---- drivers/scsi/osst.c | 3 +- drivers/scsi/qla2xxx/qla_attr.c | 3 +- drivers/scsi/qla2xxx/qla_bsg.c | 3 +- drivers/scsi/scsi_debug.c | 7 +--- drivers/staging/comedi/drivers.c | 4 +-- drivers/staging/rtl8192e/r8192E_core.c | 4 +-- drivers/staging/udlfb/udlfb.c | 5 +-- drivers/staging/xgifb/XGI_main_26.c | 3 +- drivers/staging/zram/zram_drv.c | 3 +- drivers/video/arcfb.c | 5 +-- drivers/video/broadsheetfb.c | 4 +-- drivers/video/hecubafb.c | 5 +-- drivers/video/metronomefb.c | 4 +-- drivers/video/xen-fbfront.c | 3 +- fs/ext4/super.c | 4 +-- fs/jffs2/build.c | 5 +-- fs/reiserfs/journal.c | 9 ++---- fs/reiserfs/resize.c | 4 +-- fs/udf/super.c | 5 +-- fs/xfs/linux-2.6/kmem.h | 7 +---- include/linux/coda_linux.h | 26 ++++++++++------ kernel/profile.c | 6 +-- kernel/relay.c | 4 +-- mm/memcontrol.c | 5 +-- mm/page_cgroup.c | 3 +- mm/percpu.c | 8 +---- mm/swapfile.c | 3 +- net/core/pktgen.c | 3 +- net/netfilter/x_tables.c | 5 +-- net/rds/ib_cm.c | 6 +-- sound/oss/dev_table.c | 6 +-- virt/kvm/kvm_main.c | 13 ++------ 89 files changed, 167 insertions(+), 328 deletions(-) -- 1.7.3.1.g432b3.dirty -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 44/49] mm: Use vzalloc 2010-11-05 3:07 ` [PATCH 00/49] Use vzalloc not vmalloc/kmemset Joe Perches @ 2010-11-05 3:08 ` Joe Perches 0 siblings, 0 replies; 14+ messages in thread From: Joe Perches @ 2010-11-05 3:08 UTC (permalink / raw) To: Jiri Kosina Cc: Balbir Singh, Daisuke Nishimura, KAMEZAWA Hiroyuki, Paul Menage, Li Zefan, linux-mm, linux-kernel, containers Signed-off-by: Joe Perches <joe@perches.com> --- mm/memcontrol.c | 5 ++--- mm/page_cgroup.c | 3 +-- mm/percpu.c | 8 ++------ mm/swapfile.c | 3 +-- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9a99cfa..90da698 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4199,14 +4199,13 @@ static struct mem_cgroup *mem_cgroup_alloc(void) /* Can be very big if MAX_NUMNODES is very big */ if (size < PAGE_SIZE) - mem = kmalloc(size, GFP_KERNEL); + mem = kzalloc(size, GFP_KERNEL); else - mem = vmalloc(size); + mem = vzalloc(size); if (!mem) return NULL; - memset(mem, 0, size); mem->stat = alloc_percpu(struct mem_cgroup_stat_cpu); if (!mem->stat) { if (size < PAGE_SIZE) diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c index 5bffada..34970c7 100644 --- a/mm/page_cgroup.c +++ b/mm/page_cgroup.c @@ -450,11 +450,10 @@ int swap_cgroup_swapon(int type, unsigned long max_pages) length = ((max_pages/SC_PER_PAGE) + 1); array_size = length * sizeof(void *); - array = vmalloc(array_size); + array = vzalloc(array_size); if (!array) goto nomem; - memset(array, 0, array_size); ctrl = &swap_cgroup_ctrl[type]; mutex_lock(&swap_cgroup_mutex); ctrl->length = length; diff --git a/mm/percpu.c b/mm/percpu.c index efe8168..9e16d1c 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -293,12 +293,8 @@ static void *pcpu_mem_alloc(size_t size) if (size <= PAGE_SIZE) return kzalloc(size, GFP_KERNEL); - else { - void *ptr = vmalloc(size); - if (ptr) - memset(ptr, 0, size); - return ptr; - } + else + return vzalloc(size); } /** diff --git a/mm/swapfile.c b/mm/swapfile.c index 67ddaaf..43e6988 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2044,13 +2044,12 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) goto bad_swap; /* OK, set up the swap map and apply the bad block list */ - swap_map = vmalloc(maxpages); + swap_map = vzalloc(maxpages); if (!swap_map) { error = -ENOMEM; goto bad_swap; } - memset(swap_map, 0, maxpages); nr_good_pages = maxpages - 1; /* omit header page */ for (i = 0; i < swap_header->info.nr_badpages; i++) { -- 1.7.3.1.g432b3.dirty -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-11-03 15:20 ` jovi zhang 2010-11-03 15:31 ` Christoph Lameter 2010-11-03 15:48 ` Joe Perches @ 2010-11-03 16:37 ` Américo Wang 2 siblings, 0 replies; 14+ messages in thread From: Américo Wang @ 2010-11-03 16:37 UTC (permalink / raw) To: jovi zhang Cc: Christoph Lameter, Jesper Juhl, Balbir Singh, Minchan Kim, linux-kernel, linux-mm, Paul Menage, Li Zefan, containers On Wed, Nov 03, 2010 at 11:20:32PM +0800, jovi zhang wrote: >On Wed, Nov 3, 2010 at 10:38 PM, Christoph Lameter <cl@linux.com> wrote: >> On Mon, 1 Nov 2010, Jesper Juhl wrote: >> >>> On Sun, 31 Oct 2010, Balbir Singh wrote: >> >>> > > There are so many placed need vzalloc. >>> > > Thanks, Jesper. >> >> >> Could we avoid this painful exercise with a "semantic patch"? >> >Can we make a grep script to walk all files to find vzalloc usage like this? >No need to send patch mail one by one like this. No, grep doesn't understand C. :) -- Live like a child, think like the god. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] cgroup: Avoid a memset by using vzalloc 2010-10-30 21:35 [PATCH] cgroup: Avoid a memset by using vzalloc Jesper Juhl 2010-10-30 23:34 ` Minchan Kim @ 2010-11-01 22:00 ` Paul Menage 1 sibling, 0 replies; 14+ messages in thread From: Paul Menage @ 2010-11-01 22:00 UTC (permalink / raw) To: Jesper Juhl; +Cc: linux-kernel, linux-mm, Li Zefan, containers On Sat, Oct 30, 2010 at 2:35 PM, Jesper Juhl <jj@chaosbits.net> wrote: > Hi, > > We can avoid doing a memset in swap_cgroup_swapon() by using vzalloc(). > > > Signed-off-by: Jesper Juhl <jj@chaosbits.net> Acked-by: Paul Menage <menage@google.com> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-11-05 3:09 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-10-30 21:35 [PATCH] cgroup: Avoid a memset by using vzalloc Jesper Juhl 2010-10-30 23:34 ` Minchan Kim 2010-10-31 17:33 ` Balbir Singh 2010-11-01 5:40 ` Jesper Juhl 2010-11-03 14:38 ` Christoph Lameter 2010-11-03 15:20 ` jovi zhang 2010-11-03 15:31 ` Christoph Lameter 2010-11-03 15:48 ` Joe Perches 2010-11-03 16:10 ` Christoph Lameter 2010-11-04 21:43 ` Jesper Juhl 2010-11-05 3:07 ` [PATCH 00/49] Use vzalloc not vmalloc/kmemset Joe Perches 2010-11-05 3:08 ` [PATCH 44/49] mm: Use vzalloc Joe Perches 2010-11-03 16:37 ` [PATCH] cgroup: Avoid a memset by using vzalloc Américo Wang 2010-11-01 22:00 ` Paul Menage
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox