cgroup: Avoid a memset by using vzalloc
Subsystems (49)
PATCH 1/1 cgroup: Avoid a memset by using vzalloc
Hi,
We can avoid doing a memset in swap_cgroup_swapon() by using vzalloc().
---
compile tested only.
page_cgroup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
mm/page_cgroup.c +1 -2
@@ -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;
Signature · 9 lines
Jesper Juhl <[email protected]> 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 [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): alpine.LNX.2.00.1010302333130.1572-h2p7t3/[email protected]
Minchan Kim
Reviewed-byQuoted 6 lines · Jesper Juhl
Hi,
We can avoid doing a memset in
swap_cgroup_swapon()by usingvzalloc().Signed-off-by Jesper Juhl <[email protected]>
There are so many placed need vzalloc.
Thanks, Jesper.
Signature · 2 lines
Kind regards, Minchan Kim
Paul Menage
Acked-byQuoted 6 lines · Jesper Juhl
Hi,
We can avoid doing a memset in
swap_cgroup_swapon()by usingvzalloc().Signed-off-by Jesper Juhl <[email protected]>
Quoted 6 lines · Jesper Juhl
Hi,
We can avoid doing a memset in
swap_cgroup_swapon()by usingvzalloc().Signed-off-by Jesper Juhl <[email protected]>
There are so many placed need vzalloc.
Thanks, Jesper.
Signature · 9 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. 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:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): AANLkTi=nMU3ezNFD8LKBhJxr6CmW6-qHY_Mo3HRt6Os0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Balbir Singh
Acked-byQuoted 11 lines · MinChan Kim
Quoted 6 lines · Jesper Juhl
Hi,
We can avoid doing a memset in
swap_cgroup_swapon()by usingvzalloc().Signed-off-by Jesper Juhl <[email protected]>Reviewed-by Minchan Kim <[email protected]>There are so many placed need vzalloc.
Thanks, Jesper.
Yes, please check memcontrol.c as well
Signature · 2 lines
Three Cheers, Balbir
Balbir Singh
Acked-byQuoted 11 lines · MinChan Kim
Quoted 6 lines · Jesper Juhl
Hi,
We can avoid doing a memset in
swap_cgroup_swapon()by usingvzalloc().Signed-off-by Jesper Juhl <[email protected]>Reviewed-by Minchan Kim <[email protected]>There are so many placed need vzalloc.
Thanks, Jesper.
Yes, please check memcontrol.c as well
Signature · 2 lines
Three Cheers, Balbir
A message that is not in the archive (sent off-list or not yet received): 20101031173336.GA28141-SINUvgVNF2CyUtPGxGje5AC/[email protected]
Quoted 8 lines · Balbir Singh
Quoted 6 lines · MinChan Kim
Quoted 5 lines · Jesper Juhl
Hi,
We can avoid doing a memset in
swap_cgroup_swapon()by usingvzalloc().
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Jesper Juhl <[email protected]>Reviewed-by Minchan Kim <[email protected]>There are so many placed need vzalloc.
Thanks, Jesper.Yes, please check
memcontrol.cas well
I will shortly, I'm slowly working my way through a mountain of code checking for this. I'll get to memcontrol.c
Quoted 3 lines
Acked-by Balbir Singh <[email protected]>
Thanks.
Signature · 3 lines
Jesper Juhl <[email protected]> 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
Quoted 8 lines · Balbir Singh
Quoted 6 lines · MinChan Kim
Quoted 5 lines · Jesper Juhl
Hi,
We can avoid doing a memset in
swap_cgroup_swapon()by usingvzalloc().
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Jesper Juhl <[email protected]>Reviewed-by Minchan Kim <[email protected]>There are so many placed need vzalloc.
Thanks, Jesper.Yes, please check
memcontrol.cas well
I will shortly, I'm slowly working my way through a mountain of code checking for this. I'll get to memcontrol.c
Quoted 3 lines
Acked-by Balbir Singh <[email protected]>
Thanks.
Signature · 3 lines
Jesper Juhl <[email protected]> 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
A message that is not in the archive (sent off-list or not yet received): alpine.LNX.2.00.1011010639410.31190-h2p7t3/[email protected]
Quoted 4 lines · Jesper Juhl
Quoted 2 lines · Balbir Singh
Quoted 2 lines
There are so many placed need vzalloc.
Thanks, Jesper.
Could we avoid this painful exercise with a "semantic patch"?
Quoted 4 lines · Jesper Juhl
Quoted 2 lines · Balbir Singh
Quoted 2 lines
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 [email protected]. 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:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.00.1011030937580.10599-sBS69tsa9Uj/[email protected]
Quoted 8 lines · Christoph Lameter
Quoted 4 lines · Jesper Juhl
Quoted 2 lines · Balbir Singh
Quoted 2 lines
There are so many placed need vzalloc.
Thanks, Jesper.
Quoted 7 lines
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 [email protected]
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.
_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers
Quoted 8 lines · Christoph Lameter
Quoted 4 lines · Jesper Juhl
Quoted 2 lines · Balbir Singh
Quoted 2 lines
There are so many placed need vzalloc.
Thanks, Jesper.
Quoted 7 lines
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 [email protected]
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 [email protected]. 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:"[email protected]"> [email protected] </a>
Quoted 5 lines · jovi zhang
Quoted 1 line · Christoph Lameter
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/
A message that is not in the archive (sent off-list or not yet received): AANLkTinhAQ7mNQWtjWCOWEHHwgUf+BynMM7jnVBMG32--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 10 lines · jovi zhang
Quoted 9 lines · Christoph Lameter
Quoted 4 lines · Jesper Juhl
Quoted 2 lines · Balbir Singh
Quoted 2 lines
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
Quoted 5 lines · jovi zhang
Quoted 4 lines · Christoph Lameter
Quoted 1 line · Jesper Juhl
On Sun, 31 Oct 2010, Balbir Singh wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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. :)
Signature · 1 line
Live like a child, think like the god.
Quoted 10 lines · jovi zhang
Quoted 9 lines · Christoph Lameter
Quoted 4 lines · Jesper Juhl
Quoted 2 lines · Balbir Singh
Quoted 2 lines
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 [email protected]. 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:"[email protected]"> [email protected] </a>
Quoted 6 lines · Joe Perches
Quoted 5 lines · jovi zhang
Quoted 4 lines · Christoph Lameter
Quoted 1 line · Jesper Juhl
On Sun, 31 Oct 2010, Balbir Singh wrote:
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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)
Quoted 4 lines
Perhaps this is good enough?
cp
scripts/coccinelle/api/alloc/kzalloc-simple.cocciscripts/coccinelle/api/alloc/vzalloc-simple.coccised -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?
Quoted 6 lines · Joe Perches
Quoted 5 lines · jovi zhang
Quoted 4 lines · Christoph Lameter
Quoted 1 line · Jesper Juhl
On Sun, 31 Oct 2010, Balbir Singh wrote:
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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)
Quoted 4 lines
Perhaps this is good enough?
cp
scripts/coccinelle/api/alloc/kzalloc-simple.cocciscripts/coccinelle/api/alloc/vzalloc-simple.coccised -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 [email protected]. 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:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.00.1011031108260.11625-sBS69tsa9Uj/[email protected]
Quoted 21 lines · Christoph Lameter
Quoted 6 lines · Joe Perches
Quoted 5 lines · jovi zhang
Quoted 4 lines · Christoph Lameter
Quoted 1 line · Jesper Juhl
On Sun, 31 Oct 2010, Balbir Singh wrote:
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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)
Quoted 8 lines
Quoted 4 lines
Perhaps this is good enough?
cp
scripts/coccinelle/api/alloc/kzalloc-simple.cocciscripts/coccinelle/api/alloc/vzalloc-simple.coccised -i -e 's/kmalloc/vmalloc/g' -e 's/kzalloc/vzalloc/g'scripts/coccinelle/api/alloc/vzalloc-simple.cocciNot 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...?
Signature · 3 lines
Jesper Juhl <[email protected]> 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
cover Use vzalloc not vmalloc/kmemset
In reply to a message not in the archiveConverted 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(-)
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 44/49 mm: Use vzalloc
In reply to a message not in the archive--- mm/memcontrol.c | 5 ++--- mm/page_cgroup.c | 3 +-- mm/percpu.c | 8 ++------ mm/swapfile.c | 3 +-- 4 files changed, 6 insertions(+), 13 deletions(-)
mm/memcontrol.c +2 -3
@@ -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 )
mm/page_cgroup.c +1 -2
@@ -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;
mm/percpu.c +2 -6
@@ -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); }/**
mm/swapfile.c +1 -2
@@ -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++) {
Signature · 1 line
1.7.3.1.g432b3.dirty
Quoted 21 lines · Christoph Lameter
Quoted 6 lines · Joe Perches
Quoted 5 lines · jovi zhang
Quoted 4 lines · Christoph Lameter
Quoted 1 line · Jesper Juhl
On Sun, 31 Oct 2010, Balbir Singh wrote:
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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)
Quoted 8 lines
Quoted 4 lines
Perhaps this is good enough?
cp
scripts/coccinelle/api/alloc/kzalloc-simple.cocciscripts/coccinelle/api/alloc/vzalloc-simple.coccised -i -e 's/kmalloc/vmalloc/g' -e 's/kzalloc/vzalloc/g'scripts/coccinelle/api/alloc/vzalloc-simple.cocciNot 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...?
Signature · 3 lines
Jesper Juhl <[email protected]> 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
cover Use vzalloc not vmalloc/kmemset
In reply to Christoph LameterConverted 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(-)
Signature · 6 lines
1.7.3.1.g432b3.dirty _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/49 arch/ia64: Use vzalloc
In reply to Christoph Lameter--- arch/ia64/kernel/perfmon.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
arch/ia64/kernel/perfmon.c +1 -2
@@ -829,10 +829,9 @@ pfm_rvmalloc(unsigned long size)unsigned long addr; size =PAGE_ALIGN (size); - mem =vmalloc (size); + mem =vzalloc (size);if (mem) {//printk("perfmon: CPU%d pfm_rvmalloc(%ld)=%p\n", smp_processor_id(), size, mem); -memset (mem,0 , size); addr = (unsigned long )mem;while (size >0 ) {pfm_reserve_page (addr);
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 2/49 arch/mips: Use vzalloc
In reply to Christoph Lameter--- arch/mips/sibyte/common/sb_tbprof.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
arch/mips/sibyte/common/sb_tbprof.c +1 -2
@@ -410,14 +410,13 @@ static int sbprof_tb_open(struct inode *inode, struct file *filp)return -EBUSY ;memset (&sbp,0 ,sizeof (struct sbprof_tb )); - sbp.sbprof_tbbuf =vmalloc (MAX_TBSAMPLE_BYTES ); + sbp.sbprof_tbbuf =vzalloc (MAX_TBSAMPLE_BYTES );if (!sbp.sbprof_tbbuf) { sbp.open =SB_CLOSED ;wmb ();return -ENOMEM ; } -memset (sbp.sbprof_tbbuf,0 ,MAX_TBSAMPLE_BYTES );init_waitqueue_head (&sbp.tb_sync);init_waitqueue_head (&sbp.tb_read);mutex_init (&sbp.lock);
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 02/49] arch/mips: Use vzalloc
Thanks, queued for 2.6.38.
Ralf
PATCH 3/49 arch/powerpc: Use vzalloc
In reply to Christoph Lameter--- arch/powerpc/kvm/book3s.c | 6 ++---- arch/powerpc/platforms/cell/spufs/lscsa_alloc.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)
arch/powerpc/kvm/book3s.c +2 -4
@@ -1307,13 +1307,11 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)int err = -ENOMEM ;unsigned long p; - vcpu_book3s =vmalloc (sizeof (struct kvmppc_vcpu_book3s )); + vcpu_book3s =vzalloc (sizeof (struct kvmppc_vcpu_book3s ));if (!vcpu_book3s) goto out; -memset (vcpu_book3s,0 ,sizeof (struct kvmppc_vcpu_book3s )); - - vcpu_book3s->shadow_vcpu = (struct kvmppc_book3s_shadow_vcpu *) + vcpu_book3s->shadow_vcpu =kzalloc (sizeof (*vcpu_book3s->shadow_vcpu),GFP_KERNEL );if (!vcpu_book3s->shadow_vcpu) goto free_vcpu;
arch/powerpc/platforms/cell/spufs/lscsa_alloc.c +1 -2
@@ -36,10 +36,9 @@ static int spu_alloc_lscsa_std(struct spu_state *csa)struct spu_lscsa *lscsa;unsigned char *p; - lscsa =vmalloc (sizeof (struct spu_lscsa )); + lscsa =vzalloc (sizeof (struct spu_lscsa ));if (!lscsa)return -ENOMEM ; -memset (lscsa,0 ,sizeof (struct spu_lscsa )); csa->lscsa = lscsa;/* Set LS pages reserved to allow for user-space mapping. */
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [Cbe-oss-dev] [PATCH 03/49] arch/powerpc: Use vzalloc
Hi Joe,
Quoted 7 lines
(quoted diff) +0
-0
b/arch/powerpc/platforms/cell/spufs/lscsa_alloc.cindex a101abf..3b894f5 100644arch/powerpc/platforms/cell/spufs/lscsa_alloc.c +0
-0@@ -36,10 +36,9 @@ static int spu_alloc_lscsa_std(struct spu_state *csa)struct spu_lscsa *lscsa;
arch/powerpc/platforms/cell/spufs/lscsa_alloc.c static int spu_alloc_lscsa_std(struct spu_state *csa) · line 44
Quoted 10 lines
arch/powerpc/platforms/cell/spufs/lscsa_alloc.c +1
-2unsigned char *p; - lscsa =vmalloc (sizeof (struct spu_lscsa )); + lscsa =vzalloc (sizeof (struct spu_lscsa ));if (!lscsa)return -ENOMEM ; -memset (lscsa,0 ,sizeof (struct spu_lscsa )); csa->lscsa = lscsa;/* Set LS pages reserved to allow for user-space mapping. */
For the spufs bit:
Cheers,
Jeremy
PATCH 4/49 arch/s390: Use vzalloc
In reply to Christoph Lameter--- arch/s390/hypfs/hypfs_diag.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
arch/s390/hypfs/hypfs_diag.c +1 -2
@@ -570,12 +570,11 @@ static int dbfs_d204_open(struct inode *inode, struct file *file)if (!data)return -ENOMEM ; buf_size =PAGE_SIZE * (diag204_buf_pages +1 ) +sizeof (d204->hdr); - data->base =vmalloc (buf_size); + data->base =vzalloc (buf_size);if (!data->base) { rc = -ENOMEM ; goto fail_kfree_data; } -memset (data->base,0 , buf_size); d204 =page_align_ptr (data->base +sizeof (d204->hdr)) -sizeof (d204->hdr); rc =diag204_do_store (&d204->buf, diag204_buf_pages);
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 5/49 arch/x86: Use vzalloc
In reply to Christoph Lameter--- arch/x86/kernel/microcode_amd.c | 3 +-- arch/x86/kvm/x86.c | 3 +-- arch/x86/mm/pageattr-test.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-)
arch/x86/kernel/microcode_amd.c +1 -2
@@ -183,9 +183,8 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)return NULL ; } - mc =vmalloc (UCODE_MAX_SIZE ); + mc =vzalloc (UCODE_MAX_SIZE );if (mc) { -memset (mc,0 ,UCODE_MAX_SIZE );if (get_ucode_data (mc, buf +UCODE_CONTAINER_SECTION_HDR , total_size)) {vfree (mc);
arch/x86/kvm/x86.c +1 -2
@@ -3174,10 +3174,9 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,spin_unlock (&kvm->mmu_lock); r = -ENOMEM ; - dirty_bitmap =vmalloc (n); + dirty_bitmap =vzalloc (n);if (!dirty_bitmap) goto out; -memset (dirty_bitmap,0 , n); r = -ENOMEM ; slots =kzalloc (sizeof (struct kvm_memslots ),GFP_KERNEL );
arch/x86/mm/pageattr-test.c +1 -2
@@ -123,12 +123,11 @@ static int pageattr_test(void)if (print)printk (KERN_INFO "CPA self-test:\n" ); - bm =vmalloc ((max_pfn_mapped +7 ) /8 ); + bm =vzalloc ((max_pfn_mapped +7 ) /8 );if (!bm) {printk (KERN_ERR "CPA Cannot vmalloc bitmap\n" );return -ENOMEM ; } -memset (bm,0 , (max_pfn_mapped +7 ) /8 ); failed +=print_split (&sa);srandom32 (100 );
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 05/49] arch/x86: Use vzalloc
arch/x86/kvm/x86.c int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, · line 3177
Quoted 10 lines · Joe Perches
arch/x86/kvm/x86.c +1
-1@@ -3174,10 +3174,9 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,spin_unlock (&kvm->mmu_lock); r = -ENOMEM ; - dirty_bitmap =vmalloc (n); + dirty_bitmap =vzalloc (n);
This vmalloc() does not exist already, see kvm.git.
Takuya
Quoted 6 lines
arch/x86/kvm/x86.c +0
-1if (!dirty_bitmap) goto out; -memset (dirty_bitmap,0 , n); r = -ENOMEM ; slots =kzalloc (sizeof (struct kvm_memslots ),GFP_KERNEL );
PATCH 6/49 crypto: Use vzalloc
In reply to Christoph Lameter--- crypto/deflate.c | 3 +-- crypto/zlib.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
crypto/deflate.c +1 -2
@@ -48,12 +48,11 @@ static int deflate_comp_init(struct deflate_ctx *ctx)int ret =0 ;struct z_stream_s *stream = &ctx->comp_stream; - stream->workspace =vmalloc (zlib_deflate_workspacesize ()); + stream->workspace =vzalloc (zlib_deflate_workspacesize ());if (!stream->workspace) { ret = -ENOMEM ; goto out; } -memset (stream->workspace,0 ,zlib_deflate_workspacesize ()); ret =zlib_deflateInit2 (stream,DEFLATE_DEF_LEVEL ,Z_DEFLATED , -DEFLATE_DEF_WINBITS ,DEFLATE_DEF_MEMLEVEL ,Z_DEFAULT_STRATEGY );
crypto/zlib.c +1 -2
@@ -95,11 +95,10 @@ static int zlib_compress_setup(struct crypto_pcomp *tfm, void *params,zlib_comp_exit (ctx); workspacesize =zlib_deflate_workspacesize (); - stream->workspace =vmalloc (workspacesize); + stream->workspace =vzalloc (workspacesize);if (!stream->workspace)return -ENOMEM ; -memset (stream->workspace,0 , workspacesize); ret = zlib_deflateInit2(stream, tb[ZLIB_COMP_LEVEL] ? nla_get_u32(tb[ZLIB_COMP_LEVEL])
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 06/49] crypto: Use vzalloc
Quoted 1 line · Joe Perches
Signed-off-by Joe Perches <[email protected]>
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
PATCH 7/49 drivers/atm: Use vzalloc
In reply to Christoph Lameter--- drivers/atm/idt77252.c | 11 ++++++----- drivers/atm/lanai.c | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/atm/idt77252.c +6 -5
@@ -3459,27 +3459,28 @@ init_card(struct atm_dev *dev) size =sizeof (struct vc_map *) * card->tct_size;IPRINTK ("%s: allocate %d byte for VC map.\n" , card->name, size); -if (NULL == (card->vcs =vmalloc (size))) { + card->vcs =vzalloc (size); +if (!card->vcs) {printk ("%s: memory allocation failure.\n" , card->name);deinit_card (card);return -1 ; } -memset (card->vcs,0 , size); size =sizeof (struct vc_map *) * card->scd_size;IPRINTK ("%s: allocate %d byte for SCD to VC mapping.\n" , card->name, size); -if (NULL == (card->scd2vc =vmalloc (size))) { + card->scd2vc =vzalloc (size); +if (!card->scd2vc) {printk ("%s: memory allocation failure.\n" , card->name);deinit_card (card);return -1 ; } -memset (card->scd2vc,0 , size); size =sizeof (struct tst_info ) * (card->tst_size -2 );IPRINTK ("%s: allocate %d byte for TST to VC mapping.\n" , card->name, size); -if (NULL == (card->soft_tst =vmalloc (size))) { + card->soft_tst =vmalloc (size); +if (!card->soft_tst) {printk ("%s: memory allocation failure.\n" , card->name);deinit_card (card);return -1 ;
drivers/atm/lanai.c +1 -2
@@ -1457,10 +1457,9 @@ static int __devinit vcc_table_allocate(struct lanai_dev *lanai)return (lanai->vccs ==NULL ) ? -ENOMEM :0 ;#else int bytes = (lanai->num_vci) *sizeof (struct lanai_vcc *); - lanai->vccs = (struct lanai_vcc **)vmalloc (bytes); + lanai->vccs =vzalloc (bytes);if (unlikely (lanai->vccs ==NULL ))return -ENOMEM ; -memset (lanai->vccs,0 , bytes);return 0 ;#endif }
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 8/49 drivers/block: Use vzalloc
In reply to Christoph Lameter--- drivers/block/drbd/drbd_bitmap.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/block/drbd/drbd_bitmap.c +2 -3
@@ -250,15 +250,14 @@ static struct page **bm_realloc_pages(struct drbd_bitmap *b, unsigned long want)* thread. As we have no disk yet, we are not in the IO path, * not even the IO path of the peer. */ bytes =sizeof (struct page *)*want; - new_pages =kmalloc (bytes,GFP_KERNEL ); + new_pages =kzalloc (bytes,GFP_KERNEL );if (!new_pages) { - new_pages =vmalloc (bytes); + new_pages =vzalloc (bytes);if (!new_pages)return NULL ; vmalloced =1 ; } -memset (new_pages,0 , bytes);if (want >= have) {for (i =0 ; i < have; i++) new_pages[i] = old_pages[i];
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 9/49 drivers/char: Use vzalloc
In reply to Christoph Lameter--- drivers/char/agp/backend.c | 3 +-- drivers/char/mspec.c | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/char/agp/backend.c +1 -2
@@ -171,7 +171,7 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) } got_gatt =1 ; - bridge->key_list =vmalloc (PAGE_SIZE *4 ); + bridge->key_list =vzalloc (PAGE_SIZE *4 );if (bridge->key_list ==NULL ) {dev_err (&bridge->dev->dev,"can't allocate memory for key lists\n" );
@@ -181,7 +181,6 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) got_keylist =1 ;/* FIXME vmalloc'd memory not guaranteed contiguous */ -memset (bridge->key_list,0 ,PAGE_SIZE *4 );if (bridge->driver->configure ()) {dev_err (&bridge->dev->dev,"error configuring host chipset\n" );
drivers/char/mspec.c +2 -3
@@ -271,14 +271,13 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma, pages = (vma->vm_end - vma->vm_start) >>PAGE_SHIFT ; vdata_size =sizeof (struct vma_data ) + pages *sizeof (long );if (vdata_size <=PAGE_SIZE ) - vdata =kmalloc (vdata_size,GFP_KERNEL ); + vdata =kzalloc (vdata_size,GFP_KERNEL );else { - vdata =vmalloc (vdata_size); + vdata =vzalloc (vdata_size); flags =VMD_VMALLOCED ; }if (!vdata)return -ENOMEM ; -memset (vdata,0 , vdata_size); vdata->vm_start = vma->vm_start; vdata->vm_end = vma->vm_end;
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 10/49 drivers/gpu: Use vzalloc
In reply to Christoph Lameter--- drivers/gpu/drm/via/via_dmablit.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/via/via_dmablit.c +2 -2
@@ -235,9 +235,9 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) vsg->num_pages =VIA_PFN (xfer->mem_addr + (xfer->num_lines * xfer->mem_stride -1 )) - first_pfn +1 ; -if (NULL == (vsg->pages =vmalloc (sizeof (struct page *) * vsg->num_pages))) + vsg->pages =vzalloc (sizeof (struct page *) * vsg->num_pages); +if (NULL == vsg->pages)return -ENOMEM ; -memset (vsg->pages,0 ,sizeof (struct page *) * vsg->num_pages);down_read (¤t->mm->mmap_sem); ret = get_user_pages(current, current->mm, (unsigned long)xfer->mem_addr,
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 10/49] drivers/gpu: Use vzalloc
Quoted 2 lines · Joe Perches
Signed-off-by Joe Perches<[email protected]>
Quoted 21 lines
--- drivers/gpu/drm/via/via_dmablit.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/via/via_dmablit.c +2
-2@@ -235,9 +235,9 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) vsg->num_pages =VIA_PFN (xfer->mem_addr + (xfer->num_lines * xfer->mem_stride -1 )) - first_pfn +1 ; -if (NULL == (vsg->pages =vmalloc (sizeof (struct page *) * vsg->num_pages))) + vsg->pages =vzalloc (sizeof (struct page *) * vsg->num_pages); +if (NULL == vsg->pages)return -ENOMEM ; -memset (vsg->pages,0 ,sizeof (struct page *) * vsg->num_pages);down_read (¤t->mm->mmap_sem); ret = get_user_pages(current, current->mm, (unsigned long)xfer->mem_addr,
PATCH 11/49 drivers/hid: Use vzalloc
In reply to Christoph Lameter--- drivers/hid/hid-core.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/hid/hid-core.c +1 -2
@@ -652,13 +652,12 @@ int hid_parse_report(struct hid_device *device, __u8 *start,return -ENOMEM ; device->rsize = size; - parser =vmalloc (sizeof (struct hid_parser )); + parser =vzalloc (sizeof (struct hid_parser ));if (!parser) { ret = -ENOMEM ; goto err; } -memset (parser,0 ,sizeof (struct hid_parser )); parser->device = device; end = start + size;
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 12/49 drivers/infiniband: Use vzalloc
In reply to Christoph Lameter--- 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 +-- 8 files changed, 15 insertions(+), 34 deletions(-)
drivers/infiniband/hw/amso1100/c2_rnic.c +2 -3
@@ -459,13 +459,12 @@ int __devinit c2_rnic_init(struct c2_dev *c2dev) IB_DEVICE_MEM_WINDOW);/* Allocate the qptr_array */ - c2dev->qptr_array =vmalloc (C2_MAX_CQS *sizeof (void *)); + c2dev->qptr_array =vzalloc (C2_MAX_CQS *sizeof (void *));if (!c2dev->qptr_array) {return -ENOMEM ; } -/* Inialize the qptr_array */ -memset (c2dev->qptr_array,0 ,C2_MAX_CQS *sizeof (void *)); +/* Initialize the qptr_array */ c2dev->qptr_array[0 ] = (void *) &c2dev->req_vq; c2dev->qptr_array[1 ] = (void *) &c2dev->rep_vq; c2dev->qptr_array[2 ] = (void *) &c2dev->aeq;
drivers/infiniband/hw/ehca/ipz_pt_fn.c +2 -3
@@ -222,15 +222,14 @@ int ipz_queue_ctor(struct ehca_pd *pd, struct ipz_queue *queue, queue->small_page =NULL ;/* allocate queue page pointers */ - queue->queue_pages =kmalloc (nr_of_pages *sizeof (void *),GFP_KERNEL ); + queue->queue_pages =kzalloc (nr_of_pages *sizeof (void *),GFP_KERNEL );if (!queue->queue_pages) { - queue->queue_pages =vmalloc (nr_of_pages *sizeof (void *)); + queue->queue_pages =vzalloc (nr_of_pages *sizeof (void *));if (!queue->queue_pages) {ehca_gen_err ("Couldn't allocate queue page list" );return 0 ; } } -memset (queue->queue_pages,0 , nr_of_pages *sizeof (void *));/* allocate actual queue pages */ if (is_small) {
drivers/infiniband/hw/ipath/ipath_driver.c +1 -2
@@ -199,12 +199,11 @@ static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev) goto bail; } - dd =vmalloc (sizeof (*dd)); + dd =vzalloc (sizeof (*dd));if (!dd) { dd =ERR_PTR (-ENOMEM ); goto bail; } -memset (dd,0 ,sizeof (*dd)); dd->ipath_unit =-1 ;spin_lock_irqsave (&ipath_devs_lock, flags);
drivers/infiniband/hw/ipath/ipath_file_ops.c +3 -8
@@ -1531,7 +1531,7 @@ static int init_subports(struct ipath_devdata *dd, } num_subports = uinfo->spu_subport_cnt; - pd->subport_uregbase =vmalloc (PAGE_SIZE * num_subports); + pd->subport_uregbase =vzalloc (PAGE_SIZE * num_subports);if (!pd->subport_uregbase) { ret = -ENOMEM ; goto bail;
@@ -1539,13 +1539,13 @@ static int init_subports(struct ipath_devdata *dd,/* Note: pd->port_rcvhdrq_size isn't initialized yet. */ size =ALIGN (dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize *sizeof (u32),PAGE_SIZE ) * num_subports; - pd->subport_rcvhdr_base =vmalloc (size); + pd->subport_rcvhdr_base =vzalloc (size);if (!pd->subport_rcvhdr_base) { ret = -ENOMEM ; goto bail_ureg; } - pd->subport_rcvegrbuf =vmalloc (pd->port_rcvegrbuf_chunks * + pd->subport_rcvegrbuf =vzalloc (pd->port_rcvegrbuf_chunks * pd->port_rcvegrbuf_size * num_subports);if (!pd->subport_rcvegrbuf) {
@@ -1557,11 +1557,6 @@ static int init_subports(struct ipath_devdata *dd, pd->port_subport_id = uinfo->spu_subport_id; pd->active_slaves =1 ;set_bit (IPATH_PORT_MASTER_UNINIT , &pd->port_flag); -memset (pd->subport_uregbase,0 ,PAGE_SIZE * num_subports); -memset (pd->subport_rcvhdr_base,0 , size); -memset (pd->subport_rcvegrbuf,0 , pd->port_rcvegrbuf_chunks * - pd->port_rcvegrbuf_size * - num_subports); goto bail; bail_rhdr:
drivers/infiniband/hw/ipath/ipath_init_chip.c +1 -4
@@ -442,7 +442,7 @@ static void init_shadow_tids(struct ipath_devdata *dd)struct page **pages;dma_addr_t *addrs; - pages =vmalloc (dd->ipath_cfgports * dd->ipath_rcvtidcnt * + pages =vzalloc (dd->ipath_cfgports * dd->ipath_rcvtidcnt *sizeof (struct page *));if (!pages) { ipath_dev_err(dd, "failed to allocate shadow page * "
@@ -461,9 +461,6 @@ static void init_shadow_tids(struct ipath_devdata *dd)return ; } -memset (pages,0 , dd->ipath_cfgports * dd->ipath_rcvtidcnt * -sizeof (struct page *)); - dd->ipath_pageshadow = pages; dd->ipath_physshadow = addrs; }
drivers/infiniband/hw/qib/qib_init.c +2 -5
@@ -268,23 +268,20 @@ static void init_shadow_tids(struct qib_devdata *dd)struct page **pages;dma_addr_t *addrs; - pages =vmalloc (dd->cfgctxts * dd->rcvtidcnt *sizeof (struct page *)); + pages =vzalloc (dd->cfgctxts * dd->rcvtidcnt *sizeof (struct page *));if (!pages) {qib_dev_err (dd,"failed to allocate shadow page * " "array, no expected sends!\n" ); goto bail; } - addrs =vmalloc (dd->cfgctxts * dd->rcvtidcnt *sizeof (dma_addr_t)); + addrs =vzalloc (dd->cfgctxts * dd->rcvtidcnt *sizeof (dma_addr_t));if (!addrs) {qib_dev_err (dd,"failed to allocate shadow dma handle " "array, no expected sends!\n" ); goto bail_free; } -memset (pages,0 , dd->cfgctxts * dd->rcvtidcnt *sizeof (struct page *)); -memset (addrs,0 , dd->cfgctxts * dd->rcvtidcnt *sizeof (dma_addr_t)); - dd->pageshadow = pages; dd->physshadow = addrs;return ;
drivers/infiniband/ulp/ipoib/ipoib_cm.c +3 -7
@@ -352,15 +352,13 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_iint ret;int i; - rx->rx_ring =vmalloc (ipoib_recvq_size *sizeof *rx->rx_ring); + rx->rx_ring =vzalloc (ipoib_recvq_size *sizeof *rx->rx_ring);if (!rx->rx_ring) {printk (KERN_WARNING "%s: failed to allocate CM non-SRQ ring (%d entries)\n" , priv->ca->name, ipoib_recvq_size);return -ENOMEM ; } -memset (rx->rx_ring,0 , ipoib_recvq_size *sizeof *rx->rx_ring); - t =kmalloc (sizeof *t,GFP_KERNEL );if (!t) { ret = -ENOMEM ;
@@ -1097,13 +1095,12 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,struct ipoib_dev_priv *priv =netdev_priv (p->dev);int ret; - p->tx_ring =vmalloc (ipoib_sendq_size *sizeof *p->tx_ring); + p->tx_ring =vzalloc (ipoib_sendq_size *sizeof *p->tx_ring);if (!p->tx_ring) {ipoib_warn (priv,"failed to allocate tx ring\n" ); ret = -ENOMEM ; goto err_tx; } -memset (p->tx_ring,0 , ipoib_sendq_size *sizeof *p->tx_ring); p->qp =ipoib_cm_create_tx_qp (p->dev, p);if (IS_ERR (p->qp)) {
@@ -1520,7 +1517,7 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)return ; } - priv->cm.srq_ring =vmalloc (ipoib_recvq_size *sizeof *priv->cm.srq_ring); + priv->cm.srq_ring =vzalloc (ipoib_recvq_size *sizeof *priv->cm.srq_ring);if (!priv->cm.srq_ring) {printk (KERN_WARNING "%s: failed to allocate CM SRQ ring (%d entries)\n" , priv->ca->name, ipoib_recvq_size);
@@ -1529,7 +1526,6 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)return ; } -memset (priv->cm.srq_ring,0 , ipoib_recvq_size *sizeof *priv->cm.srq_ring); }int ipoib_cm_dev_init (struct net_device *dev)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -2
@@ -925,13 +925,12 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port) goto out; } - priv->tx_ring =vmalloc (ipoib_sendq_size *sizeof *priv->tx_ring); + priv->tx_ring =vzalloc (ipoib_sendq_size *sizeof *priv->tx_ring);if (!priv->tx_ring) {printk (KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n" , ca->name, ipoib_sendq_size); goto out_rx_ring_cleanup; } -memset (priv->tx_ring,0 , ipoib_sendq_size *sizeof *priv->tx_ring);/* priv->tx_head, tx_tail & tx_outstanding are already 0 */
Signature · 6 lines
1.7.3.1.g432b3.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/49] drivers/infiniband: Use vzalloc
thanks, applied
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 13/49 drivers/isdn: Use vzalloc
In reply to Christoph Lameter--- drivers/isdn/i4l/isdn_common.c | 4 ++-- drivers/isdn/mISDN/dsp_core.c | 3 +-- drivers/isdn/mISDN/l1oip_codec.c | 6 ++---- 3 files changed, 5 insertions(+), 8 deletions(-)
drivers/isdn/i4l/isdn_common.c +2 -2
@@ -2315,11 +2315,11 @@ static int __init isdn_init(void)int i;char tmprev[50 ]; -if (!(dev =vmalloc (sizeof (isdn_dev)))) { + dev =vzalloc (sizeof (isdn_dev)); +if (!dev) {printk (KERN_WARNING "isdn: Could not allocate device-struct.\n" );return -EIO ; } -memset ((char *) dev,0 ,sizeof (isdn_dev));init_timer (&dev->timer); dev->timer.function = isdn_timer_funct;spin_lock_init (&dev->lock);
drivers/isdn/mISDN/dsp_core.c +1 -2
@@ -1052,12 +1052,11 @@ dspcreate(struct channel_req *crq)if (crq->protocol !=ISDN_P_B_L2DSP && crq->protocol !=ISDN_P_B_L2DSPHDLC )return -EPROTONOSUPPORT ; - ndsp =vmalloc (sizeof (struct dsp )); + ndsp =vzalloc (sizeof (struct dsp ));if (!ndsp) {printk (KERN_ERR "%s: vmalloc struct dsp failed\n" , __func__);return -ENOMEM ; } -memset (ndsp,0 ,sizeof (struct dsp ));if (dsp_debug &DEBUG_DSP_CTRL )printk (KERN_DEBUG "%s: creating new dsp instance\n" , __func__);
drivers/isdn/mISDN/l1oip_codec.c +2 -4
@@ -330,14 +330,12 @@ l1oip_4bit_alloc(int ulaw)return 0 ;/* alloc conversion tables */ - table_com =vmalloc (65536 ); - table_dec =vmalloc (512 ); + table_com =vzalloc (65536 ); + table_dec =vzalloc (512 );if (!table_com || !table_dec) {l1oip_4bit_free ();return -ENOMEM ; } -memset (table_com,0 ,65536 ); -memset (table_dec,0 ,512 );/* generate compression table */ i1 =0 ;while (i1 <256 ) {
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 14/49 drivers/md: Use vzalloc
In reply to Christoph Lameter--- drivers/md/dm-log.c | 3 +-- drivers/md/dm-snap-persistent.c | 3 +-- drivers/md/dm-table.c | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-)
drivers/md/dm-log.c +1 -2
@@ -487,7 +487,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,memset (lc->sync_bits, (sync ==NOSYNC ) ?-1 :0 , bitset_size); lc->sync_count = (sync ==NOSYNC ) ? region_count :0 ; - lc->recovering_bits =vmalloc (bitset_size); + lc->recovering_bits =vzalloc (bitset_size);if (!lc->recovering_bits) {DMWARN ("couldn't allocate sync bitset" );vfree (lc->sync_bits);
@@ -499,7 +499,6 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,kfree (lc);return -ENOMEM ; } -memset (lc->recovering_bits,0 , bitset_size); lc->sync_search =0 ; log->context = lc;
drivers/md/dm-snap-persistent.c +1 -2
@@ -174,10 +174,9 @@ static int alloc_area(struct pstore *ps)if (!ps->area) goto err_area; - ps->zero_area =vmalloc (len); + ps->zero_area =vzalloc (len);if (!ps->zero_area) goto err_zero_area; -memset (ps->zero_area,0 , len); ps->header_area =vmalloc (len);if (!ps->header_area)
drivers/md/dm-table.c +1 -3
@@ -151,9 +151,7 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size)return NULL ; size = nmemb * elem_size; - addr =vmalloc (size); -if (addr) -memset (addr,0 , size); + addr =vzalloc (size);return addr; }
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 14/49] drivers/md: Use vzalloc
Quoted 1 line · Joe Perches
Signed-off-by Joe Perches <[email protected]>
Subject for final commit should be: "dm: Use vzalloc"
Original patch may be referenced here:
https://patchwork.kernel.org/patch/303242/mbox/
PATCH 15/49 drivers/media: Use vzalloc
In reply to Christoph Lameter--- 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 +-- 4 files changed, 4 insertions(+), 8 deletions(-)
drivers/media/dvb/ngene/ngene-core.c +1 -2
@@ -1537,12 +1537,11 @@ int __devinit ngene_probe(struct pci_dev *pci_dev,if (pci_enable_device (pci_dev) <0 )return -ENODEV ; - dev =vmalloc (sizeof (struct ngene )); + dev =vzalloc (sizeof (struct ngene ));if (dev ==NULL ) { stat = -ENOMEM ; goto fail0; } -memset (dev,0 ,sizeof (struct ngene )); dev->pci_dev = pci_dev; dev->card_info = (struct ngene_info *)id->driver_data;
drivers/media/video/mx3_camera.c +1 -2
@@ -1182,13 +1182,12 @@ static int __devinit mx3_camera_probe(struct platform_device *pdev) goto egetres; } - mx3_cam =vmalloc (sizeof (*mx3_cam)); + mx3_cam =vzalloc (sizeof (*mx3_cam));if (!mx3_cam) {dev_err (&pdev->dev,"Could not allocate mx3 camera object\n" ); err = -ENOMEM ; goto ealloc; } -memset (mx3_cam,0 ,sizeof (*mx3_cam)); mx3_cam->clk =clk_get (&pdev->dev,NULL );if (IS_ERR (mx3_cam->clk)) {
drivers/media/video/pwc/pwc-if.c +1 -2
@@ -288,14 +288,13 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)/* create frame buffers, and make circular ring */ for (i =0 ; i < default_fbufs; i++) {if (pdev->fbuf[i].data ==NULL ) { - kbuf =vmalloc (PWC_FRAME_SIZE );/* need vmalloc since frame buffer > 128K */ + kbuf =vzalloc (PWC_FRAME_SIZE );/* need vmalloc since frame buffer > 128K */ if (kbuf ==NULL ) {PWC_ERROR ("Failed to allocate frame buffer %d.\n" , i);return -ENOMEM ; }PWC_DEBUG_MEMORY ("Allocated frame buffer %d at %p.\n" , i, kbuf); pdev->fbuf[i].data = kbuf; -memset (kbuf,0 ,PWC_FRAME_SIZE ); } }
drivers/media/video/videobuf-dma-sg.c +1 -2
@@ -69,10 +69,9 @@ static struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt,struct page *pg;int i; - sglist =vmalloc (nr_pages *sizeof (*sglist)); + sglist =vzalloc (nr_pages *sizeof (*sglist));if (NULL == sglist)return NULL ; -memset (sglist,0 , nr_pages *sizeof (*sglist));sg_init_table (sglist, nr_pages);for (i =0 ; i < nr_pages; i++, virt +=PAGE_SIZE ) { pg =vmalloc_to_page (virt);
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 16/49 drivers/mtd: Use vzalloc
In reply to Christoph Lameter--- drivers/mtd/nand/nandsim.c | 3 +-- drivers/mtd/ubi/vtbl.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/mtd/nand/nandsim.c +1 -2
@@ -470,7 +470,7 @@ static int alloc_device(struct nandsim *ns) err = -EINVAL ; goto err_close; } - ns->pages_written =vmalloc (ns->geom.pgnum); + ns->pages_written =vzalloc (ns->geom.pgnum);if (!ns->pages_written) {NS_ERR ("alloc_device: unable to allocate pages written array\n" ); err = -ENOMEM ;
@@ -483,7 +483,6 @@ static int alloc_device(struct nandsim *ns) goto err_free; } ns->cfile = cfile; -memset (ns->pages_written,0 , ns->geom.pgnum);return 0 ; }
drivers/mtd/ubi/vtbl.c +2 -4
@@ -425,12 +425,11 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,/* Read both LEB 0 and LEB 1 into memory */ ubi_rb_for_each_entry (rb, seb, &sv->root, u.rb) { - leb[seb->lnum] =vmalloc (ubi->vtbl_size); + leb[seb->lnum] =vzalloc (ubi->vtbl_size);if (!leb[seb->lnum]) { err = -ENOMEM ; goto out_free; } -memset (leb[seb->lnum],0 , ubi->vtbl_size); err =ubi_io_read_data (ubi, leb[seb->lnum], seb->pnum,0 , ubi->vtbl_size);
@@ -516,10 +515,9 @@ static struct ubi_vtbl_record *create_empty_lvol(struct ubi_device *ubi,int i;struct ubi_vtbl_record *vtbl; - vtbl =vmalloc (ubi->vtbl_size); + vtbl =vzalloc (ubi->vtbl_size);if (!vtbl)return ERR_PTR (-ENOMEM ); -memset (vtbl,0 , ubi->vtbl_size);for (i =0 ; i < ubi->vtbl_slots; i++)memcpy (&vtbl[i], &empty_vtbl_record,UBI_VTBL_RECORD_SIZE );
Signature · 1 line
1.7.3.1.g432b3.dirty
Artem Bityutskiy
AppliedRe: [PATCH 16/49] drivers/mtd: Use vzalloc
Quoted 5 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>--- drivers/mtd/nand/nandsim.c | 3 +-- drivers/mtd/ubi/vtbl.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-)
Pushed to l2-mtd-2.6.git, thanks.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
PATCH 17/49 drivers/net/cxgb3: Use vzalloc
In reply to Christoph Lameter--- drivers/net/cxgb3/cxgb3_offload.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/cxgb3/cxgb3_offload.c +3 -4
@@ -1164,12 +1164,11 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)*/ void *cxgb_alloc_mem (unsigned long size) { -void *p =kmalloc (size,GFP_KERNEL ); +void *p =kzalloc (size,GFP_KERNEL );if (!p) - p =vmalloc (size); -if (p) -memset (p,0 , size); + p =vzalloc (size); +return p; }
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 18/49 drivers/net/cxgb4: Use vzalloc
In reply to Christoph Lameter--- drivers/net/cxgb4/cxgb4_main.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/cxgb4/cxgb4_main.c +3 -4
@@ -868,12 +868,11 @@ out: release_firmware(fw);*/ void *t4_alloc_mem (size_t size) { -void *p =kmalloc (size,GFP_KERNEL ); +void *p =kzalloc (size,GFP_KERNEL );if (!p) - p =vmalloc (size); -if (p) -memset (p,0 , size); + p =vzalloc (size); +return p; }
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 19/49 drivers/net/e1000: Use vzalloc
In reply to Christoph Lameter--- drivers/net/e1000/e1000_main.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/e1000/e1000_main.c +2 -4
@@ -1425,13 +1425,12 @@ static int e1000_setup_tx_resources(struct e1000_adapter *adapter,int size; size =sizeof (struct e1000_buffer ) * txdr->count; - txdr->buffer_info =vmalloc (size); + txdr->buffer_info =vzalloc (size);if (!txdr->buffer_info) {e_err (probe,"Unable to allocate memory for the Tx descriptor " "ring\n" );return -ENOMEM ; } -memset (txdr->buffer_info,0 , size);/* round up to nearest 4K */
@@ -1621,13 +1620,12 @@ static int e1000_setup_rx_resources(struct e1000_adapter *adapter,int size, desc_len; size =sizeof (struct e1000_buffer ) * rxdr->count; - rxdr->buffer_info =vmalloc (size); + rxdr->buffer_info =vzalloc (size);if (!rxdr->buffer_info) {e_err (probe,"Unable to allocate memory for the Rx descriptor " "ring\n" );return -ENOMEM ; } -memset (rxdr->buffer_info,0 , size); desc_len =sizeof (struct e1000_rx_desc );
Signature · 14 lines
1.7.3.1.g432b3.dirty ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 20/49 drivers/net/e1000e: Use vzalloc
In reply to Christoph Lameter--- drivers/net/e1000e/netdev.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/e1000e/netdev.c +2 -4
@@ -2059,10 +2059,9 @@ int e1000e_setup_tx_resources(struct e1000_adapter *adapter)int err = -ENOMEM , size; size =sizeof (struct e1000_buffer ) * tx_ring->count; - tx_ring->buffer_info =vmalloc (size); + tx_ring->buffer_info =vzalloc (size);if (!tx_ring->buffer_info) goto err; -memset (tx_ring->buffer_info,0 , size);/* round up to nearest 4K */ tx_ring->size = tx_ring->count *sizeof (struct e1000_tx_desc );
@@ -2095,10 +2094,9 @@ int e1000e_setup_rx_resources(struct e1000_adapter *adapter)int i, size, desc_len, err = -ENOMEM ; size =sizeof (struct e1000_buffer ) * rx_ring->count; - rx_ring->buffer_info =vmalloc (size); + rx_ring->buffer_info =vzalloc (size);if (!rx_ring->buffer_info) goto err; -memset (rx_ring->buffer_info,0 , size);for (i =0 ; i < rx_ring->count; i++) { buffer_info = &rx_ring->buffer_info[i];
Signature · 14 lines
1.7.3.1.g432b3.dirty ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 21/49 drivers/net/ehea: Use vzalloc
In reply to Christoph Lameter--- drivers/net/ehea/ehea_main.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/net/ehea/ehea_main.c +1 -3
@@ -1496,12 +1496,10 @@ static int ehea_init_q_skba(struct ehea_q_skb_arr *q_skba, int max_q_entries) {int arr_size =sizeof (void *) * max_q_entries; - q_skba->arr =vmalloc (arr_size); + q_skba->arr =vzalloc (arr_size);if (!q_skba->arr)return -ENOMEM ; -memset (q_skba->arr,0 , arr_size); - q_skba->len = max_q_entries; q_skba->index =0 ; q_skba->os_skbs =0 ;
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 22/49 drivers/net/igb: Use vzalloc
In reply to Christoph Lameter--- drivers/net/igb/igb_main.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/igb/igb_main.c +2 -4
@@ -2436,10 +2436,9 @@ int igb_setup_tx_resources(struct igb_ring *tx_ring)int size; size =sizeof (struct igb_buffer ) * tx_ring->count; - tx_ring->buffer_info =vmalloc (size); + tx_ring->buffer_info =vzalloc (size);if (!tx_ring->buffer_info) goto err; -memset (tx_ring->buffer_info,0 , size);/* round up to nearest 4K */ tx_ring->size = tx_ring->count *sizeof (union e1000_adv_tx_desc );
@@ -2587,10 +2586,9 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring)int size, desc_len; size =sizeof (struct igb_buffer ) * rx_ring->count; - rx_ring->buffer_info =vmalloc (size); + rx_ring->buffer_info =vzalloc (size);if (!rx_ring->buffer_info) goto err; -memset (rx_ring->buffer_info,0 , size); desc_len =sizeof (union e1000_adv_rx_desc );
Signature · 14 lines
1.7.3.1.g432b3.dirty ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 23/49 drivers/net/igbvf: Use vzalloc
In reply to Christoph Lameter--- drivers/net/igbvf/netdev.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/igbvf/netdev.c +2 -4
@@ -429,10 +429,9 @@ int igbvf_setup_tx_resources(struct igbvf_adapter *adapter,int size; size =sizeof (struct igbvf_buffer ) * tx_ring->count; - tx_ring->buffer_info =vmalloc (size); + tx_ring->buffer_info =vzalloc (size);if (!tx_ring->buffer_info) goto err; -memset (tx_ring->buffer_info,0 , size);/* round up to nearest 4K */ tx_ring->size = tx_ring->count *sizeof (union e1000_adv_tx_desc );
@@ -469,10 +468,9 @@ int igbvf_setup_rx_resources(struct igbvf_adapter *adapter,int size, desc_len; size =sizeof (struct igbvf_buffer ) * rx_ring->count; - rx_ring->buffer_info =vmalloc (size); + rx_ring->buffer_info =vzalloc (size);if (!rx_ring->buffer_info) goto err; -memset (rx_ring->buffer_info,0 , size); desc_len =sizeof (union e1000_adv_rx_desc );
Signature · 14 lines
1.7.3.1.g432b3.dirty ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
RE: [PATCH 23/49] drivers/net/igbvf: Use vzalloc
Quoted 46 lines
-----Original Message-----
From: Joe Perches [mailto:[email protected]]
Sent: Thursday, November 04, 2010 8:08 PM
To: Jiri Kosina
Cc: Kirsher, Jeffrey T; Brandeburg, Jesse; Allan, Bruce W; Wyborny, Carolyn; Skidmore, Donald C; Rose, Gregory V; Waskiewicz Jr, Peter P; Duyck, Alexander H; Ronciak, John; [email protected]; [email protected]; [email protected]
Subject: [PATCH 23/49]drivers/net/igbvf: Use vzallocSigned-off-by Joe Perches <[email protected]>--- drivers/net/igbvf/netdev.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)drivers/net/igbvf/netdev.c +1
-2@@ -429,10 +429,9 @@ int igbvf_setup_tx_resources(struct igbvf_adapter *adapter, int size; size =sizeof (struct igbvf_buffer ) * tx_ring->count; - tx_ring->buffer_info =vmalloc (size); + tx_ring->buffer_info =vzalloc (size);if (!tx_ring->buffer_info) goto err; -memset (tx_ring->buffer_info,0 , size);/* round up to nearest 4K */ drivers/net/igbvf/netdev.c +1
-3tx_ring->size = tx_ring->count *sizeof (union e1000_adv_tx_desc );@@ -469,10 +468,9 @@ int igbvf_setup_rx_resources(struct igbvf_adapter *adapter, int size, desc_len; size =sizeof (struct igbvf_buffer ) * rx_ring->count; - rx_ring->buffer_info =vmalloc (size); + rx_ring->buffer_info =vzalloc (size);if (!rx_ring->buffer_info) goto err; -memset (rx_ring->buffer_info,0 , size); desc_len =sizeof (union e1000_adv_rx_desc ); --
Quoted 1 line
1.7.3.1.g432b3.dirty
Acked By: Greg Rose <[email protected]>
PATCH 24/49 drivers/net/ixgb: Use vzalloc
In reply to Christoph Lameter--- drivers/net/ixgb/ixgb_main.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/ixgb/ixgb_main.c +2 -4
@@ -669,13 +669,12 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)int size; size =sizeof (struct ixgb_buffer ) * txdr->count; - txdr->buffer_info =vmalloc (size); + txdr->buffer_info =vzalloc (size);if (!txdr->buffer_info) {netif_err (adapter, probe, adapter->netdev,"Unable to allocate transmit descriptor ring memory\n" );return -ENOMEM ; } -memset (txdr->buffer_info,0 , size);/* round up to nearest 4K */
@@ -759,13 +758,12 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)int size; size =sizeof (struct ixgb_buffer ) * rxdr->count; - rxdr->buffer_info =vmalloc (size); + rxdr->buffer_info =vzalloc (size);if (!rxdr->buffer_info) {netif_err (adapter, probe, adapter->netdev,"Unable to allocate receive descriptor ring\n" );return -ENOMEM ; } -memset (rxdr->buffer_info,0 , size);/* Round up to nearest 4K */
Signature · 14 lines
1.7.3.1.g432b3.dirty ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 25/49 drivers/net/ixgbe: Use vzalloc
In reply to Christoph Lameter--- drivers/net/ixgbe/ixgbe_main.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +4 -6
@@ -4970,12 +4970,11 @@ int ixgbe_setup_tx_resources(struct ixgbe_adapter *adapter,int size; size =sizeof (struct ixgbe_tx_buffer ) * tx_ring->count; - tx_ring->tx_buffer_info =vmalloc_node (size, tx_ring->numa_node); + tx_ring->tx_buffer_info =vzalloc_node (size, tx_ring->numa_node);if (!tx_ring->tx_buffer_info) - tx_ring->tx_buffer_info =vmalloc (size); + tx_ring->tx_buffer_info =vzalloc (size);if (!tx_ring->tx_buffer_info) goto err; -memset (tx_ring->tx_buffer_info,0 , size);/* round up to nearest 4K */ tx_ring->size = tx_ring->count *sizeof (union ixgbe_adv_tx_desc );
@@ -5037,15 +5036,14 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,int size; size =sizeof (struct ixgbe_rx_buffer ) * rx_ring->count; - rx_ring->rx_buffer_info =vmalloc_node (size, adapter->node); + rx_ring->rx_buffer_info =vzalloc_node (size, adapter->node);if (!rx_ring->rx_buffer_info) - rx_ring->rx_buffer_info =vmalloc (size); + rx_ring->rx_buffer_info =vzalloc (size);if (!rx_ring->rx_buffer_info) {e_err (probe,"vmalloc allocation failed for the Rx " "descriptor ring\n" ); goto alloc_failed; } -memset (rx_ring->rx_buffer_info,0 , size);/* Round up to nearest 4K */ rx_ring->size = rx_ring->count *sizeof (union ixgbe_adv_rx_desc );
Signature · 14 lines
1.7.3.1.g432b3.dirty ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 26/49 drivers/net/ixgbevf: Use vzalloc
In reply to Christoph Lameter--- drivers/net/ixgbevf/ixgbevf_main.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/ixgbevf/ixgbevf_main.c +2 -4
@@ -2488,10 +2488,9 @@ int ixgbevf_setup_tx_resources(struct ixgbevf_adapter *adapter,int size; size =sizeof (struct ixgbevf_tx_buffer ) * tx_ring->count; - tx_ring->tx_buffer_info =vmalloc (size); + tx_ring->tx_buffer_info =vzalloc (size);if (!tx_ring->tx_buffer_info) goto err; -memset (tx_ring->tx_buffer_info,0 , size);/* round up to nearest 4K */ tx_ring->size = tx_ring->count *sizeof (union ixgbe_adv_tx_desc );
@@ -2555,14 +2554,13 @@ int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *adapter,int size; size =sizeof (struct ixgbevf_rx_buffer ) * rx_ring->count; - rx_ring->rx_buffer_info =vmalloc (size); + rx_ring->rx_buffer_info =vzalloc (size);if (!rx_ring->rx_buffer_info) {hw_dbg (&adapter->hw,"Unable to vmalloc buffer memory for " "the receive descriptor ring\n" ); goto alloc_failed; } -memset (rx_ring->rx_buffer_info,0 , size);/* Round up to nearest 4K */ rx_ring->size = rx_ring->count *sizeof (union ixgbe_adv_rx_desc );
Signature · 14 lines
1.7.3.1.g432b3.dirty ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
RE: [PATCH 26/49] drivers/net/ixgbevf: Use vzalloc
Quoted 49 lines
-----Original Message-----
From: Joe Perches [mailto:[email protected]]
Sent: Thursday, November 04, 2010 8:08 PM
To: Jiri Kosina
Cc: Kirsher, Jeffrey T; Brandeburg, Jesse; Allan, Bruce W; Wyborny, Carolyn; Skidmore, Donald C; Rose, Gregory V; Waskiewicz Jr, Peter P; Duyck, Alexander H; Ronciak, John; [email protected]; [email protected]; [email protected]
Subject: [PATCH 26/49]drivers/net/ixgbevf: Use vzallocSigned-off-by Joe Perches <[email protected]>--- drivers/net/ixgbevf/ixgbevf_main.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)drivers/net/ixgbevf/ixgbevf_main.c +1
-2@@ -2488,10 +2488,9 @@ int ixgbevf_setup_tx_resources(structixgbevf_adapter *adapter, int size; size =sizeof (struct ixgbevf_tx_buffer ) * tx_ring->count; - tx_ring->tx_buffer_info =vmalloc (size); + tx_ring->tx_buffer_info =vzalloc (size);if (!tx_ring->tx_buffer_info) goto err; -memset (tx_ring->tx_buffer_info,0 , size);/* round up to nearest 4K */ drivers/net/ixgbevf/ixgbevf_main.c +1
-2tx_ring->size = tx_ring->count *sizeof (union ixgbe_adv_tx_desc );@@ -2555,14 +2554,13 @@ int ixgbevf_setup_rx_resources(structixgbevf_adapter *adapter, int size; size =sizeof (struct ixgbevf_rx_buffer ) * rx_ring->count; - rx_ring->rx_buffer_info =vmalloc (size); + rx_ring->rx_buffer_info =vzalloc (size);if (!rx_ring->rx_buffer_info) {hw_dbg (&adapter->hw,"Unable to vmalloc buffer memory for " "the receive descriptor ring\n" ); goto alloc_failed; } -memset (rx_ring->rx_buffer_info,0 , size);/* Round up to nearest 4K */
Quoted 3 lines
rx_ring->size=rx_ring->count*sizeof(union ixgbe_adv_rx_desc);
--
1.7.3.1.g432b3.dirty
Acked By: Greg Rose <[email protected]>
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 27/49 drivers/net/netxen: Use vzalloc
In reply to Christoph Lameter--- drivers/net/netxen/netxen_nic_init.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/net/netxen/netxen_nic_init.c +2 -5
@@ -214,13 +214,12 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) tx_ring->num_desc = adapter->num_txd; tx_ring->txq =netdev_get_tx_queue (netdev,0 ); - cmd_buf_arr =vmalloc (TX_BUFF_RINGSIZE (tx_ring)); + cmd_buf_arr =vzalloc (TX_BUFF_RINGSIZE (tx_ring));if (cmd_buf_arr ==NULL ) {dev_err (&pdev->dev,"%s: failed to allocate cmd buffer ring\n" , netdev->name); goto err_out; } -memset (cmd_buf_arr,0 ,TX_BUFF_RINGSIZE (tx_ring)); tx_ring->cmd_buf_arr = cmd_buf_arr; recv_ctx = &adapter->recv_ctx;
@@ -279,8 +278,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)break ; } - rds_ring->rx_buf_arr = (struct netxen_rx_buffer *) -vmalloc (RCV_BUFF_RINGSIZE (rds_ring)); + rds_ring->rx_buf_arr =vzalloc (RCV_BUFF_RINGSIZE (rds_ring));if (rds_ring->rx_buf_arr ==NULL ) { printk(KERN_ERR "%s: Failed to allocate " "rx buffer ring %d\n",
@@ -288,7 +286,6 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)/* free whatever was already allocated */ goto err_out; } -memset (rds_ring->rx_buf_arr,0 ,RCV_BUFF_RINGSIZE (rds_ring));INIT_LIST_HEAD (&rds_ring->free_list);/* * Now go through all of them, set reference handles
Signature · 1 line
1.7.3.1.g432b3.dirty
RE: [PATCH 27/49] drivers/net/netxen: Use vzalloc
Quoted 10 lines
From: Joe Perches [[email protected]]
Sent: Friday, November 05, 2010 8:37 AM
To: Jiri Kosina
Cc: Amit Salecha; [email protected]; [email protected]
Subject: [PATCH 27/49]drivers/net/netxen: Use vzallocSigned-off-by Joe Perches <[email protected]>---
drivers/net/netxen/netxen_nic_init.c| 7 ++-----
files changed, 2 insertions(+), 5 deletions(-)
Thanks.
PATCH 28/49 drivers/net/pch_gbe: Use vzalloc
In reply to Christoph Lameter--- drivers/net/pch_gbe/pch_gbe_main.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/pch_gbe/pch_gbe_main.c +2 -4
@@ -1523,12 +1523,11 @@ int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter,int desNo; size = (int )sizeof (struct pch_gbe_buffer ) * tx_ring->count; - tx_ring->buffer_info =vmalloc (size); + tx_ring->buffer_info =vzalloc (size);if (!tx_ring->buffer_info) {pr_err ("Unable to allocate memory for the buffer infomation\n" );return -ENOMEM ; } -memset (tx_ring->buffer_info,0 , size); tx_ring->size = tx_ring->count * (int )sizeof (struct pch_gbe_tx_desc );
@@ -1573,12 +1572,11 @@ int pch_gbe_setup_rx_resources(struct pch_gbe_adapter *adapter,int desNo; size = (int )sizeof (struct pch_gbe_buffer ) * rx_ring->count; - rx_ring->buffer_info =vmalloc (size); + rx_ring->buffer_info =vzalloc (size);if (!rx_ring->buffer_info) {pr_err ("Unable to allocate memory for the receive descriptor ring\n" );return -ENOMEM ; } -memset (rx_ring->buffer_info,0 , size); rx_ring->size = rx_ring->count * (int )sizeof (struct pch_gbe_rx_desc ); rx_ring->desc =dma_alloc_coherent (&pdev->dev, rx_ring->size, &rx_ring->dma,GFP_KERNEL );
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 29/49 drivers/net/qlcnic: Use vzalloc
In reply to Christoph Lameter--- drivers/net/qlcnic/qlcnic_init.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/net/qlcnic/qlcnic_init.c +2 -5
@@ -236,12 +236,11 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter) tx_ring->num_desc = adapter->num_txd; tx_ring->txq =netdev_get_tx_queue (netdev,0 ); - cmd_buf_arr =vmalloc (TX_BUFF_RINGSIZE (tx_ring)); + cmd_buf_arr =vzalloc (TX_BUFF_RINGSIZE (tx_ring));if (cmd_buf_arr ==NULL ) {dev_err (&netdev->dev,"failed to allocate cmd buffer ring\n" ); goto err_out; } -memset (cmd_buf_arr,0 ,TX_BUFF_RINGSIZE (tx_ring)); tx_ring->cmd_buf_arr = cmd_buf_arr; recv_ctx = &adapter->recv_ctx;
@@ -275,14 +274,12 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter) rds_ring->dma_size +NET_IP_ALIGN ;break ; } - rds_ring->rx_buf_arr = (struct qlcnic_rx_buffer *) -vmalloc (RCV_BUFF_RINGSIZE (rds_ring)); + rds_ring->rx_buf_arr =vzalloc (RCV_BUFF_RINGSIZE (rds_ring));if (rds_ring->rx_buf_arr ==NULL ) {dev_err (&netdev->dev,"Failed to allocate " "rx buffer ring %d\n" , ring); goto err_out; } -memset (rds_ring->rx_buf_arr,0 ,RCV_BUFF_RINGSIZE (rds_ring));INIT_LIST_HEAD (&rds_ring->free_list);/* * Now go through all of them, set reference handles
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 30/49 drivers/net/sfc: Use vzalloc
In reply to Christoph Lameter--- drivers/net/sfc/filter.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/sfc/filter.c +1 -2
@@ -428,10 +428,9 @@ int efx_probe_filters(struct efx_nic *efx) GFP_KERNEL);if (!table->used_bitmap) goto fail; - table->spec =vmalloc (table->size *sizeof (*table->spec)); + table->spec =vzalloc (table->size *sizeof (*table->spec));if (!table->spec) goto fail; -memset (table->spec,0 , table->size *sizeof (*table->spec)); }return 0 ;
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 31/49 drivers/net/vxge: Use vzalloc
In reply to Christoph Lameter--- drivers/net/vxge/vxge-config.c | 37 +++++++++---------------------------- 1 files changed, 9 insertions(+), 28 deletions(-)
drivers/net/vxge/vxge-config.c +9 -28
@@ -776,14 +776,12 @@ vxge_hw_device_initialize(if (status !=VXGE_HW_OK ) goto exit; - hldev = (struct __vxge_hw_device *) -vmalloc (sizeof (struct __vxge_hw_device )); + hldev =vzalloc (sizeof (struct __vxge_hw_device ));if (hldev ==NULL ) { status =VXGE_HW_ERR_OUT_OF_MEMORY ; goto exit; } -memset (hldev,0 ,sizeof (struct __vxge_hw_device )); hldev->magic =VXGE_HW_DEVICE_MAGIC ;vxge_hw_device_debug_set (hldev,VXGE_ERR ,VXGE_COMPONENT_ALL );
@@ -1627,15 +1625,12 @@ __vxge_hw_mempool_grow(struct vxge_hw_mempool *mempool, u32 num_allocate,* allocate new memblock and its private part at once. * This helps to minimize memory usage a lot. */ mempool->memblocks_priv_arr[i] = -vmalloc (mempool->items_priv_size * n_items); +vzalloc (mempool->items_priv_size * n_items);if (mempool->memblocks_priv_arr[i] ==NULL ) { status =VXGE_HW_ERR_OUT_OF_MEMORY ; goto exit; } -memset (mempool->memblocks_priv_arr[i],0 , - mempool->items_priv_size * n_items); -/* allocate DMA-capable memblock */ mempool->memblocks_arr[i] = __vxge_hw_blockpool_malloc(mempool->devh,
@@ -1707,13 +1702,11 @@ __vxge_hw_mempool_create( goto exit; } - mempool = (struct vxge_hw_mempool *) -vmalloc (sizeof (struct vxge_hw_mempool )); + mempool =vzalloc (sizeof (struct vxge_hw_mempool ));if (mempool ==NULL ) { status =VXGE_HW_ERR_OUT_OF_MEMORY ; goto exit; } -memset (mempool,0 ,sizeof (struct vxge_hw_mempool )); mempool->devh = devh; mempool->memblock_size = memblock_size;
@@ -1733,31 +1726,27 @@ __vxge_hw_mempool_create(/* allocate array of memblocks */ mempool->memblocks_arr = - (void **)vmalloc (sizeof (void *) * mempool->memblocks_max); +vzalloc (sizeof (void *) * mempool->memblocks_max);if (mempool->memblocks_arr ==NULL ) {__vxge_hw_mempool_destroy (mempool); status =VXGE_HW_ERR_OUT_OF_MEMORY ; mempool =NULL ; goto exit; } -memset (mempool->memblocks_arr,0 , -sizeof (void *) * mempool->memblocks_max);/* allocate array of private parts of items per memblocks */ mempool->memblocks_priv_arr = - (void **)vmalloc (sizeof (void *) * mempool->memblocks_max); +vzalloc (sizeof (void *) * mempool->memblocks_max);if (mempool->memblocks_priv_arr ==NULL ) {__vxge_hw_mempool_destroy (mempool); status =VXGE_HW_ERR_OUT_OF_MEMORY ; mempool =NULL ; goto exit; } -memset (mempool->memblocks_priv_arr,0 , -sizeof (void *) * mempool->memblocks_max);/* allocate array of memblocks DMA objects */ - mempool->memblocks_dma_arr = (struct vxge_hw_mempool_dma *) -vmalloc (sizeof (struct vxge_hw_mempool_dma ) * + mempool->memblocks_dma_arr = +vzalloc (sizeof (struct vxge_hw_mempool_dma ) * mempool->memblocks_max);if (mempool->memblocks_dma_arr ==NULL ) {
@@ -1766,20 +1755,15 @@ __vxge_hw_mempool_create( mempool =NULL ; goto exit; } -memset (mempool->memblocks_dma_arr,0 , -sizeof (struct vxge_hw_mempool_dma ) * - mempool->memblocks_max);/* allocate hash array of items */ - mempool->items_arr = - (void **)vmalloc (sizeof (void *) * mempool->items_max); + mempool->items_arr =vzalloc (sizeof (void *) * mempool->items_max);if (mempool->items_arr ==NULL ) {__vxge_hw_mempool_destroy (mempool); status =VXGE_HW_ERR_OUT_OF_MEMORY ; mempool =NULL ; goto exit; } -memset (mempool->items_arr,0 ,sizeof (void *) * mempool->items_max);/* calculate initial number of memblocks */ memblocks_to_allocate = (mempool->items_initial +
@@ -4242,15 +4226,12 @@ vxge_hw_vpath_open(struct __vxge_hw_device *hldev,if (status !=VXGE_HW_OK ) goto vpath_open_exit1; - vp = (struct __vxge_hw_vpath_handle *) -vmalloc (sizeof (struct __vxge_hw_vpath_handle )); + vp =vzalloc (sizeof (struct __vxge_hw_vpath_handle ));if (vp ==NULL ) { status =VXGE_HW_ERR_OUT_OF_MEMORY ; goto vpath_open_exit2; } -memset (vp,0 ,sizeof (struct __vxge_hw_vpath_handle )); - vp->vpath = vpath;if (vpath->vp_config->fifo.enable ==VXGE_HW_FIFO_ENABLE ) {
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 32/49 drivers/net/bnx2.c: Use vzalloc
In reply to Christoph Lameter--- drivers/net/bnx2.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-)
drivers/net/bnx2.c +2 -8
@@ -766,13 +766,10 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)int j; rxr->rx_buf_ring = -vmalloc (SW_RXBD_RING_SIZE * bp->rx_max_ring); +vzalloc (SW_RXBD_RING_SIZE * bp->rx_max_ring);if (rxr->rx_buf_ring ==NULL )return -ENOMEM ; -memset (rxr->rx_buf_ring,0 , -SW_RXBD_RING_SIZE * bp->rx_max_ring); -for (j =0 ; j < bp->rx_max_ring; j++) { rxr->rx_desc_ring[j] = dma_alloc_coherent(&bp->pdev->dev,
@@ -785,13 +782,10 @@ bnx2_alloc_rx_mem(struct bnx2 *bp) }if (bp->rx_pg_ring_size) { - rxr->rx_pg_ring =vmalloc (SW_RXPG_RING_SIZE * + rxr->rx_pg_ring =vzalloc (SW_RXPG_RING_SIZE * bp->rx_max_pg_ring);if (rxr->rx_pg_ring ==NULL )return -ENOMEM ; - -memset (rxr->rx_pg_ring,0 ,SW_RXPG_RING_SIZE * - bp->rx_max_pg_ring); }for (j =0 ; j < bp->rx_max_pg_ring; j++) {
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 33/49 drivers/s390: Use vzalloc
In reply to Christoph Lameter--- drivers/s390/cio/blacklist.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/s390/cio/blacklist.c +1 -2
@@ -335,10 +335,9 @@ cio_ignore_write(struct file *file, const char __user *user_buf,return -EINVAL ;if (user_len >65536 ) user_len =65536 ; - buf =vmalloc (user_len +1 );/* maybe better use the stack? */ + buf =vzalloc (user_len +1 );/* maybe better use the stack? */ if (buf ==NULL )return -ENOMEM ; -memset (buf,0 , user_len +1 );if (strncpy_from_user (buf, user_buf, user_len) <0 ) { rc = -EFAULT ;
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 34/49 drivers/scsi: Use vzalloc
In reply to Christoph Lameter--- 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 ++----- 7 files changed, 11 insertions(+), 25 deletions(-)
drivers/scsi/bfa/bfad.c +1 -2
@@ -600,13 +600,12 @@ retry: meminfo_elem = &hal_meminfo->meminfo[i];switch (meminfo_elem->mem_type) {case BFA_MEM_TYPE_KVA : - kva =vmalloc (meminfo_elem->mem_len); + kva =vzalloc (meminfo_elem->mem_len);if (kva ==NULL ) {bfad_hal_mem_release (bfad); rc =BFA_STATUS_ENOMEM ; goto ext; } -memset (kva,0 , meminfo_elem->mem_len); meminfo_elem->kva = kva;break ;case BFA_MEM_TYPE_DMA :
drivers/scsi/bfa/bfad_debugfs.c +2 -6
@@ -79,7 +79,7 @@ bfad_debugfs_open_fwtrc(struct inode *inode, struct file *file) fw_debug->buffer_len =sizeof (struct bfa_trc_mod_s ); - fw_debug->debug_buffer =vmalloc (fw_debug->buffer_len); + fw_debug->debug_buffer =vzalloc (fw_debug->buffer_len);if (!fw_debug->debug_buffer) {kfree (fw_debug); printk(KERN_INFO "bfad[%d]: Failed to allocate fwtrc buffer\n",
@@ -87,8 +87,6 @@ bfad_debugfs_open_fwtrc(struct inode *inode, struct file *file)return -ENOMEM ; } -memset (fw_debug->debug_buffer,0 , fw_debug->buffer_len); -spin_lock_irqsave (&bfad->bfad_lock, flags); rc = bfa_debug_fwtrc(&bfad->bfa, fw_debug->debug_buffer,
@@ -123,7 +121,7 @@ bfad_debugfs_open_fwsave(struct inode *inode, struct file *file) fw_debug->buffer_len =sizeof (struct bfa_trc_mod_s ); - fw_debug->debug_buffer =vmalloc (fw_debug->buffer_len); + fw_debug->debug_buffer =vzalloc (fw_debug->buffer_len);if (!fw_debug->debug_buffer) {kfree (fw_debug); printk(KERN_INFO "bfad[%d]: Failed to allocate fwsave buffer\n",
@@ -131,8 +129,6 @@ bfad_debugfs_open_fwsave(struct inode *inode, struct file *file)return -ENOMEM ; } -memset (fw_debug->debug_buffer,0 , fw_debug->buffer_len); -spin_lock_irqsave (&bfad->bfad_lock, flags); rc = bfa_debug_fwsave(&bfad->bfa, fw_debug->debug_buffer,
drivers/scsi/cxgbi/libcxgbi.h +3 -6
@@ -658,14 +658,11 @@ static inline u32 cxgbi_tag_nonrsvd_bits(struct cxgbi_tag_format *tformat,return v1 | v2; } -static inline void *cxgbi_alloc_big_mem (unsigned int size, -gfp_t gfp) +static inline void *cxgbi_alloc_big_mem (unsigned int size,gfp_t gfp) { -void *p =kmalloc (size, gfp); +void *p =kzalloc (size, gfp);if (!p) - p =vmalloc (size); -if (p) -memset (p,0 , size); + p =vzalloc (size);return p; }
drivers/scsi/osst.c +1 -2
@@ -2296,11 +2296,10 @@ static int osst_write_header(struct osst_tape * STp, struct osst_request ** aSRpif (STp->raw)return 0 ;if (STp->header_cache ==NULL ) { -if ((STp->header_cache = (os_header_t *)vmalloc (sizeof (os_header_t))) ==NULL ) { +if ((STp->header_cache =vzalloc (sizeof (os_header_t))) ==NULL ) {printk (KERN_ERR "%s:E: Failed to allocate header cache\n" , name);return (-ENOMEM ); } -memset (STp->header_cache,0 ,sizeof (os_header_t));#if DEBUG printk (OSST_DEB_MSG "%s:D: Allocated and cleared memory for header cache\n" , name);#endif
drivers/scsi/qla2xxx/qla_attr.c +1 -2
@@ -271,7 +271,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, ha->optrom_size - start : size; ha->optrom_state =QLA_SREADING ; - ha->optrom_buffer =vmalloc (ha->optrom_region_size); + ha->optrom_buffer =vzalloc (ha->optrom_region_size);if (ha->optrom_buffer ==NULL ) {qla_printk (KERN_WARNING , ha, "Unable to allocate memory for optrom retrieval "
@@ -291,7 +291,6 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,"Reading flash region -- 0x%x/0x%x.\n" , ha->optrom_region_start, ha->optrom_region_size)); -memset (ha->optrom_buffer,0 , ha->optrom_region_size); ha->isp_ops->read_optrom (vha, ha->optrom_buffer, ha->optrom_region_start, ha->optrom_region_size);break ;
drivers/scsi/qla2xxx/qla_bsg.c +1 -2
@@ -1356,7 +1356,7 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha, ha->optrom_state =QLA_SREADING ; } - ha->optrom_buffer =vmalloc (ha->optrom_region_size); + ha->optrom_buffer =vzalloc (ha->optrom_region_size);if (!ha->optrom_buffer) {qla_printk (KERN_WARNING , ha, "Read: Unable to allocate memory for optrom retrieval "
@@ -1366,7 +1366,6 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha,return -ENOMEM ; } -memset (ha->optrom_buffer,0 , ha->optrom_region_size);return 0 ; }
drivers/scsi/scsi_debug.c +2 -5
@@ -3305,12 +3305,11 @@ static int __init scsi_debug_init(void) (sdebug_sectors_per * sdebug_heads); } - fake_storep =vmalloc (sz); + fake_storep =vzalloc (sz);if (NULL == fake_storep) {printk (KERN_ERR "scsi_debug_init: out of memory, 1\n" );return -ENOMEM ; } -memset (fake_storep,0 , sz);if (scsi_debug_num_parts >0 )sdebug_build_parts (fake_storep, sz);
@@ -3355,7 +3354,7 @@ static int __init scsi_debug_init(void) map_size = (sdebug_store_sectors / scsi_debug_unmap_granularity); map_bytes = map_size >>3 ; - map_storep =vmalloc (map_bytes); + map_storep =vzalloc (map_bytes);printk (KERN_INFO "scsi_debug_init: %lu provisioning blocks\n" , map_size);
@@ -3366,8 +3365,6 @@ static int __init scsi_debug_init(void) goto free_vm; } -memset (map_storep,0x0 , map_bytes); -/* Map first 1KB for partition table */ if (scsi_debug_num_parts)map_region (0 ,2 );
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 35/49 drivers/staging: Use vzalloc
In reply to Christoph Lameter--- 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 +-- 5 files changed, 6 insertions(+), 13 deletions(-)
drivers/staging/comedi/drivers.c +1 -3
@@ -470,10 +470,8 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,struct page **pages =NULL ; async->buf_page_list = -vmalloc (sizeof (struct comedi_buf_page ) * n_pages); +vzalloc (sizeof (struct comedi_buf_page ) * n_pages);if (async->buf_page_list) { -memset (async->buf_page_list,0 , -sizeof (struct comedi_buf_page ) * n_pages); pages =vmalloc (sizeof (struct page *) * n_pages); }if (pages) {
drivers/staging/rtl8192e/r8192E_core.c +1 -3
@@ -2283,9 +2283,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev) IMR_TXFOVW | IMR_BcnInt | IMR_TBDOK | IMR_TBDER); priv->AcmControl =0 ; - priv->pFirmware = (rt_firmware *)vmalloc (sizeof (rt_firmware)); -if (priv->pFirmware) -memset (priv->pFirmware,0 ,sizeof (rt_firmware)); + priv->pFirmware =vzalloc (sizeof (rt_firmware));/* rx related queue */ skb_queue_head_init (&priv->rx_queue);
drivers/staging/udlfb/udlfb.c +2 -3
@@ -1163,14 +1163,13 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dev, struct fb_info *info)* But with imperfect damage info we may send pixels over USB * that were, in fact, unchanged - wasting limited USB bandwidth */ - new_back =vmalloc (new_len); + new_back =vzalloc (new_len);if (!new_back) -dl_info ("No shadow/backing buffer allcoated\n" ); +dl_info ("No shadow/backing buffer allocated\n" );else {if (dev->backing_buffer)vfree (dev->backing_buffer); dev->backing_buffer = new_back; -memset (dev->backing_buffer,0 , new_len); } }
drivers/staging/xgifb/XGI_main_26.c +1 -2
@@ -2178,8 +2178,7 @@ static int XGIfb_heap_init(void)#ifndef AGPOFF if (XGIfb_queuemode ==AGP_CMD_QUEUE ) { - agp_info =vmalloc (sizeof (*agp_info)); -memset ((void *)agp_info,0x00 ,sizeof (*agp_info)); + agp_info =vzalloc (sizeof (*agp_info));agp_copy_info (agp_info);agp_backend_acquire ();
drivers/staging/zram/zram_drv.c +1 -2
@@ -533,7 +533,7 @@ int zram_init_device(struct zram *zram) } num_pages = zram->disksize >>PAGE_SHIFT ; - zram->table =vmalloc (num_pages *sizeof (*zram->table)); + zram->table =vzalloc (num_pages *sizeof (*zram->table));if (!zram->table) {pr_err ("Error allocating zram address table\n" );/* To prevent accessing table entries during cleanup */
@@ -541,7 +541,6 @@ int zram_init_device(struct zram *zram) ret = -ENOMEM ; goto fail; } -memset (zram->table,0 , num_pages *sizeof (*zram->table));set_capacity (zram->disk, zram->disksize >>SECTOR_SHIFT );
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 36/49 drivers/video: Use vzalloc
In reply to Christoph Lameter--- 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 +-- 5 files changed, 7 insertions(+), 14 deletions(-)
drivers/video/arcfb.c +2 -3
@@ -515,11 +515,10 @@ static int __devinit arcfb_probe(struct platform_device *dev)/* We need a flat backing store for the Arc's less-flat actual paged framebuffer */ -if (!(videomemory =vmalloc (videomemorysize))) + videomemory =vmalloc (videomemorysize); +if (!videomemory)return retval; -memset (videomemory,0 , videomemorysize); - info =framebuffer_alloc (sizeof (struct arcfb_par ), &dev->dev);if (!info) goto err;
drivers/video/broadsheetfb.c +1 -3
@@ -1101,12 +1101,10 @@ static int __devinit broadsheetfb_probe(struct platform_device *dev) videomemorysize =roundup ((dpyw*dpyh),PAGE_SIZE ); - videomemory =vmalloc (videomemorysize); + videomemory =vzalloc (videomemorysize);if (!videomemory) goto err_fb_rel; -memset (videomemory,0 , videomemorysize); - info->screen_base = (char *)videomemory; info->fbops = &broadsheetfb_ops;
drivers/video/hecubafb.c +2 -3
@@ -231,11 +231,10 @@ static int __devinit hecubafb_probe(struct platform_device *dev) videomemorysize = (DPY_W *DPY_H )/8 ; -if (!(videomemory =vmalloc (videomemorysize))) + videomemory =vzalloc (videomemorysize); +if (!videomemory)return retval; -memset (videomemory,0 , videomemorysize); - info =framebuffer_alloc (sizeof (struct hecubafb_par ), &dev->dev);if (!info) goto err_fballoc;
drivers/video/metronomefb.c +1 -3
@@ -628,12 +628,10 @@ static int __devinit metronomefb_probe(struct platform_device *dev)/* we need to add a spare page because our csum caching scheme walks * to the end of the page */ videomemorysize =PAGE_SIZE + (fw * fh); - videomemory =vmalloc (videomemorysize); + videomemory =vzalloc (videomemorysize);if (!videomemory) goto err_fb_rel; -memset (videomemory,0 , videomemorysize); - info->screen_base = (char __force __iomem *)videomemory; info->fbops = &metronomefb_ops;
drivers/video/xen-fbfront.c +1 -2
@@ -395,10 +395,9 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,spin_lock_init (&info->dirty_lock);spin_lock_init (&info->resize_lock); - info->fb =vmalloc (fb_size); + info->fb =vzalloc (fb_size);if (info->fb ==NULL ) goto error_nomem; -memset (info->fb,0 , fb_size); info->nr_pages = (fb_size +PAGE_SIZE -1 ) >>PAGE_SHIFT ;
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 36/49] drivers/video: Use vzalloc
Quoted 16 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>---
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 +--5 files changed, 7 insertions(+), 14 deletions(-)drivers/video/arcfb.c +0
-0@@ -515,11 +515,10 @@ static int __devinit arcfb_probe(struct platform_device *dev) /* We need a flat backing store for the Arc's
Quoted 3 lines
less-flat actual paged framebuffer */
- if (!(videomemory = vmalloc(videomemorysize)))
+ videomemory = vmalloc(videomemorysize);
typo?
Quoted 87 lines
+ if (!videomemory)
return retval;-
memset(videomemory, 0, videomemorysize);
-
info =framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev); if (!info)
goto err;drivers/video/broadsheetfb.c +1
-3@@ -1101,12 +1101,10 @@ static int __devinit broadsheetfb_probe(struct platform_device *dev) videomemorysize = roundup((dpyw*dpyh), PAGE_SIZE); - videomemory = vmalloc(videomemorysize); + videomemory = vzalloc(videomemorysize); if (!videomemory) goto err_fb_rel; - memset(videomemory, 0, videomemorysize); - info->screen_base = (char *)videomemory; info->fbops = &broadsheetfb_ops;drivers/video/hecubafb.c +2
-3@@ -231,11 +231,10 @@ static int __devinit hecubafb_probe(struct platform_device *dev) videomemorysize = (DPY_W*DPY_H)/8; - if (!(videomemory = vmalloc(videomemorysize))) + videomemory = vzalloc(videomemorysize); + if (!videomemory) return retval; - memset(videomemory, 0, videomemorysize); - info = framebuffer_alloc(sizeof(struct hecubafb_par), &dev->dev); if (!info) goto err_fballoc;drivers/video/metronomefb.c +1
-3@@ -628,12 +628,10 @@ static int __devinit metronomefb_probe(struct platform_device *dev) /* we need to add a spare page because our csum caching scheme walks * to the end of the page */ videomemorysize = PAGE_SIZE + (fw * fh); - videomemory = vmalloc(videomemorysize); + videomemory = vzalloc(videomemorysize); if (!videomemory) goto err_fb_rel; - memset(videomemory, 0, videomemorysize); - info->screen_base = (char __force __iomem *)videomemory; info->fbops = &metronomefb_ops;drivers/video/xen-fbfront.c +1
-3@@ -395,10 +395,9 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, spin_lock_init(&info->dirty_lock); spin_lock_init(&info->resize_lock); - info->fb = vmalloc(fb_size); + info->fb = vzalloc(fb_size); if (info->fb == NULL) goto error_nomem; - memset(info->fb, 0, fb_size); info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT; --1.7.3.1.g432b3.dirty
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
Regards dave
Re: [PATCH 36/49] drivers/video: Use vzalloc
Quoted 9 lines · Dave Young
drivers/video/arcfb.c static int __devinit arcfb_probe(struct platform_device *dev) · line 518
Quoted 7 lines · Joe Perches
drivers/video/arcfb.c +1
-1@@ -515,11 +515,10 @@ static int __devinit arcfb_probe(struct platform_device *dev)/* We need a flat backing store for the Arc's less-flat actual paged framebuffer */ -if (!(videomemory =vmalloc (videomemorysize))) + videomemory =vmalloc (videomemorysize);typo?
Yes. Thanks for catching that.
Re: [PATCH 36/49] drivers/video: Use vzalloc
In reply to Joe PerchesQuoted 1 line · Joe Perches
Signed-off-by Joe Perches <[email protected]>
Looks good on xen-fb.
Quoted 98 lines
--- 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 +-- 5 files changed, 7 insertions(+), 14 deletions(-)drivers/video/arcfb.c +2
-3@@ -515,11 +515,10 @@ static int __devinit arcfb_probe(struct platform_device *dev)/* We need a flat backing store for the Arc's less-flat actual paged framebuffer */ -if (!(videomemory =vmalloc (videomemorysize))) + videomemory =vmalloc (videomemorysize); +if (!videomemory)return retval; -memset (videomemory,0 , videomemorysize); - info =framebuffer_alloc (sizeof (struct arcfb_par ), &dev->dev);if (!info) goto err;drivers/video/broadsheetfb.c +1
-3@@ -1101,12 +1101,10 @@ static int __devinit broadsheetfb_probe(struct platform_device *dev) videomemorysize =roundup ((dpyw*dpyh),PAGE_SIZE ); - videomemory =vmalloc (videomemorysize); + videomemory =vzalloc (videomemorysize);if (!videomemory) goto err_fb_rel; -memset (videomemory,0 , videomemorysize); - info->screen_base = (char *)videomemory; info->fbops = &broadsheetfb_ops;drivers/video/hecubafb.c +2
-3@@ -231,11 +231,10 @@ static int __devinit hecubafb_probe(struct platform_device *dev) videomemorysize = (DPY_W *DPY_H )/8 ; -if (!(videomemory =vmalloc (videomemorysize))) + videomemory =vzalloc (videomemorysize); +if (!videomemory)return retval; -memset (videomemory,0 , videomemorysize); - info =framebuffer_alloc (sizeof (struct hecubafb_par ), &dev->dev);if (!info) goto err_fballoc;drivers/video/metronomefb.c +1
-3@@ -628,12 +628,10 @@ static int __devinit metronomefb_probe(struct platform_device *dev)/* we need to add a spare page because our csum caching scheme walks * to the end of the page */ videomemorysize =PAGE_SIZE + (fw * fh); - videomemory =vmalloc (videomemorysize); + videomemory =vzalloc (videomemorysize);if (!videomemory) goto err_fb_rel; -memset (videomemory,0 , videomemorysize); - info->screen_base = (char __force __iomem *)videomemory; info->fbops = &metronomefb_ops;drivers/video/xen-fbfront.c +1
-2@@ -395,10 +395,9 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,spin_lock_init (&info->dirty_lock);spin_lock_init (&info->resize_lock); - info->fb =vmalloc (fb_size); + info->fb =vzalloc (fb_size);if (info->fb ==NULL ) goto error_nomem; -memset (info->fb,0 , fb_size); info->nr_pages = (fb_size +PAGE_SIZE -1 ) >>PAGE_SHIFT ;Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 37/49 fs/ext4: Use vzalloc
In reply to Christoph Lameter--- fs/ext4/super.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
fs/ext4/super.c +1 -3
@@ -1909,9 +1909,7 @@ static int ext4_fill_flex_info(struct super_block *sb) size = flex_group_count *sizeof (struct flex_groups ); sbi->s_flex_groups =kzalloc (size,GFP_KERNEL );if (sbi->s_flex_groups ==NULL ) { - sbi->s_flex_groups =vmalloc (size); -if (sbi->s_flex_groups) -memset (sbi->s_flex_groups,0 , size); + sbi->s_flex_groups =vzalloc (size); }if (sbi->s_flex_groups ==NULL ) { ext4_msg(sb, KERN_ERR, "not enough memory for "
Signature · 1 line
1.7.3.1.g432b3.dirty
Andreas Dilger
reviewerRe: [PATCH 37/49] fs/ext4: Use vzalloc
fs/ext4/super.c static int ext4_fill_flex_info(struct super_block *sb) · line 1915
Quoted 12 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>fs/ext4/super.c +1
-3@@ -1909,9 +1909,7 @@ static int ext4_fill_flex_info(struct super_block *sb) size = flex_group_count *sizeof (struct flex_groups ); sbi->s_flex_groups =kzalloc (size,GFP_KERNEL );if (sbi->s_flex_groups ==NULL ) { - sbi->s_flex_groups =vmalloc (size); -if (sbi->s_flex_groups) -memset (sbi->s_flex_groups,0 , size); + sbi->s_flex_groups =vzalloc (size); }if (sbi->s_flex_groups ==NULL ) { ext4_msg(sb, KERN_ERR, "not enough memory for "
You may as well move the second s_flex_groups == NULL check inside the first one:
if (sbi->s_flex_groups == NULL) {
sbi->s_flex_groups = vzalloc(size);
if (sbi->s_flex_groups == NULL) {
ext4_msg(sb, KERN_ERR, "not enough memory for "
"%u flex groups", flex_group_count);
goto failed;
}
}Cheers, Andreas
PATCH v2 37/49 fs/ext4: Use vzalloc
---
differences from V1:
Andreas Dilger requested a block be moved so thatsbi->s_flex_groups isn't tested for NULL twice.
Also coalesced a ext4_msg printk format.
fs/ext4/super.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)
fs/ext4/super.c +0 -0
@@ -1909,14 +1909,13 @@ static int ext4_fill_flex_info(struct
super_block *sb)
size = flex_group_count * sizeof(struct flex_groups); sbi->s_flex_groups = kzalloc(size, GFP_KERNEL); if (sbi->s_flex_groups == NULL) {
- sbi->s_flex_groups = vmalloc(size);
- if (sbi->s_flex_groups)
- memset(sbi->s_flex_groups, 0, size);
- }
- if (sbi->s_flex_groups == NULL) {
- ext4_msg(sb, KERN_ERR, "not enough memory for "
- "%u flex groups", flex_group_count);
- goto failed;
+ sbi->s_flex_groups = vzalloc(size);
+ if (sbi->s_flex_groups == NULL) {
+ ext4_msg(sb, KERN_ERR,
+ "not enough memory for %u flex groups",
+ flex_group_count);
+ goto failed;
+ }
}
for (i = 0; i < sbi->s_groups_count; i++) {
Re: [PATCH V2 37/49] fs/ext4: Use vzalloc
Quoted 6 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>---
differences from V1:
Andreas Dilger requested a block be moved so thatsbi->s_flex_groupsisn't tested for NULL twice.
Also coalesced aext4_msgprintk format.
Thanks, applied to the ext4 tree
- Ted
PATCH 38/49 fs/jffs2: Use vzalloc
In reply to Christoph Lameter--- fs/jffs2/build.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
fs/jffs2/build.c +2 -3
@@ -336,14 +336,13 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) size =sizeof (struct jffs2_eraseblock ) * c->nr_blocks;#ifndef __ECOSif (jffs2_blocks_use_vmalloc (c)) - c->blocks =vmalloc (size); + c->blocks =vzalloc (size); else#endif - c->blocks =kmalloc (size,GFP_KERNEL ); + c->blocks =kzalloc (size,GFP_KERNEL );if (!c->blocks)return -ENOMEM ; -memset (c->blocks,0 , size);for (i=0 ; i<c->nr_blocks; i++) {INIT_LIST_HEAD (&c->blocks[i].list); c->blocks[i].offset = i * c->sector_size;
Signature · 1 line
1.7.3.1.g432b3.dirty
Artem Bityutskiy
AppliedRe: [PATCH 38/49] fs/jffs2: Use vzalloc
Quoted 4 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>--- fs/jffs2/build.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
Pushed to l2-mtd-2.6.git, thanks.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
PATCH 39/49 fs/reiserfs: Use vzalloc
In reply to Christoph Lameter--- fs/reiserfs/journal.c | 9 +++------ fs/reiserfs/resize.c | 4 +--- 2 files changed, 4 insertions(+), 9 deletions(-)
fs/reiserfs/journal.c +3 -6
@@ -292,14 +292,13 @@ int reiserfs_allocate_list_bitmaps(struct super_block *sb,for (i =0 ; i <JOURNAL_NUM_BITMAPS ; i++) { jb = jb_array + i; jb->journal_list =NULL ; - jb->bitmaps =vmalloc (mem); + jb->bitmaps =vzalloc (mem);if (!jb->bitmaps) {reiserfs_warning (sb,"clm-2000" ,"unable to " "allocate bitmaps for journal lists" ); failed =1 ;break ; } -memset (jb->bitmaps,0 , mem); }if (failed) {free_list_bitmaps (sb, jb_array);
@@ -354,11 +353,10 @@ static struct reiserfs_journal_cnode *allocate_cnodes(int num_cnodes)if (num_cnodes <=0 ) {return NULL ; } - head =vmalloc (num_cnodes *sizeof (struct reiserfs_journal_cnode )); + head =vzalloc (num_cnodes *sizeof (struct reiserfs_journal_cnode ));if (!head) {return NULL ; } -memset (head,0 , num_cnodes *sizeof (struct reiserfs_journal_cnode )); head[0 ].prev =NULL ; head[0 ].next = head +1 ;for (i =1 ; i < num_cnodes; i++) {
@@ -2703,14 +2701,13 @@ int journal_init(struct super_block *sb, const char *j_dev_name,* dependency inversion warnings. */ reiserfs_write_unlock (sb); - journal =SB_JOURNAL (sb) =vmalloc (sizeof (struct reiserfs_journal )); + journal =SB_JOURNAL (sb) =vzalloc (sizeof (struct reiserfs_journal ));if (!journal) {reiserfs_warning (sb,"journal-1256" ,"unable to get memory for journal structure" );reiserfs_write_lock (sb);return 1 ; } -memset (journal,0 ,sizeof (struct reiserfs_journal ));INIT_LIST_HEAD (&journal->j_bitmap_nodes);INIT_LIST_HEAD (&journal->j_prealloc_list);INIT_LIST_HEAD (&journal->j_working_list);
fs/reiserfs/resize.c +1 -3
@@ -111,15 +111,13 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)/* allocate additional bitmap blocks, reallocate array of bitmap * block pointers */ bitmap = -vmalloc (sizeof (struct reiserfs_bitmap_info ) * bmap_nr_new); +vzalloc (sizeof (struct reiserfs_bitmap_info ) * bmap_nr_new);if (!bitmap) {/* Journal bitmaps are still supersized, but the memory isn't * leaked, so I guess it's ok */ printk ("reiserfs_resize: unable to allocate memory.\n" );return -ENOMEM ; } -memset (bitmap,0 , -sizeof (struct reiserfs_bitmap_info ) * bmap_nr_new);for (i =0 ; i < bmap_nr; i++) bitmap[i] = old_bitmap[i];
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 40/49 fs/udf: Use vzalloc
In reply to Christoph Lameter--- fs/udf/super.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
fs/udf/super.c +2 -3
@@ -959,9 +959,9 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index) (sizeof (struct buffer_head *) * nr_groups);if (size <=PAGE_SIZE ) - bitmap =kmalloc (size,GFP_KERNEL ); + bitmap =kzalloc (size,GFP_KERNEL );else - bitmap =vmalloc (size);/* TODO: get rid of vmalloc */ + bitmap =vzalloc (size);/* TODO: get rid of vmalloc */ if (bitmap ==NULL ) { udf_error(sb, __func__,
@@ -970,7 +970,6 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index)return NULL ; } -memset (bitmap,0x00 , size); bitmap->s_block_bitmap = (struct buffer_head **)(bitmap +1 ); bitmap->s_nr_groups = nr_groups;return bitmap;
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 40/49] fs/udf: Use vzalloc
Quoted 4 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>--- fs/udf/super.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
I've merged the patch into my tree.
Honza
Quoted 28 lines
fs/udf/super.c +2
-3@@ -959,9 +959,9 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index) (sizeof (struct buffer_head *) * nr_groups);if (size <=PAGE_SIZE ) - bitmap =kmalloc (size,GFP_KERNEL ); + bitmap =kzalloc (size,GFP_KERNEL );else - bitmap =vmalloc (size);/* TODO: get rid of vmalloc */ + bitmap =vzalloc (size);/* TODO: get rid of vmalloc */ if (bitmap ==NULL ) { udf_error(sb, __func__,@@ -970,7 +970,6 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index)return NULL ; } -memset (bitmap,0x00 , size); bitmap->s_block_bitmap = (struct buffer_head **)(bitmap +1 ); bitmap->s_nr_groups = nr_groups;return bitmap;Signature · 1 line
1.7.3.1.g432b3.dirty
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 40/49] fs/udf: Use vzalloc
Hi,
Quoted 17 lines · Jan Kara
Quoted 4 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>---
fs/udf/super.c | 5 ++---1 files changed, 2 insertions(+), 3 deletions(-)I've merged the patch into my tree.
Honza
Quoted 8 lines
fs/udf/super.c +0
-0@@ -959,9 +959,9 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index) (sizeof(struct buffer_head *) * nr_groups);
Quoted 6 lines
Quoted 6 lines
fs/udf/super.c +1
-1if (size <= PAGE_SIZE) - bitmap = kmalloc(size, GFP_KERNEL); + bitmap = kzalloc(size, GFP_KERNEL);else
- bitmap = vmalloc(size); /* TODO: get rid of vmalloc */
+ bitmap = vzalloc(size); /* TODO: get rid of vmalloc */
Shouldn't this comment be removed or at least changed to match the new malloc?
Quoted 17 lines
Quoted 12 lines
if (bitmap == NULL) {
udf_error(sb,__func__,fs/udf/super.c +0
-2@@ -970,7 +970,6 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index) return NULL; } - memset(bitmap, 0x00, size); bitmap->s_block_bitmap = (struct buffer_head **)(bitmap + 1); bitmap->s_nr_groups = nr_groups; return bitmap; --Quoted 2 lines
1.7.3.1.g432b3.dirty
--
Jan Kara <[email protected]>
SUSE Labs, CR
Signature · 1 line
Peter Bortas
Jan Kara
reviewerRe: [PATCH 40/49] fs/udf: Use vzalloc
Quoted 4 lines · Peter Bortas
Quoted 2 lines
Quoted 2 lines
- bitmap = vmalloc(size); /* TODO: get rid of vmalloc */
+ bitmap = vzalloc(size); /* TODO: get rid of vmalloc */Shouldn't this comment be removed or at least changed to match the new malloc?
OK, changed. Thanks for pointing this out.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH 41/49 fs/xfs: Use vzalloc
In reply to Christoph Lameter--- fs/xfs/linux-2.6/kmem.h | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
fs/xfs/linux-2.6/kmem.h +1 -6
@@ -61,12 +61,7 @@ extern void kmem_free(const void *);static inline void *kmem_zalloc_large (size_t size) { -void *ptr; - - ptr =vmalloc (size); -if (ptr) -memset (ptr,0 , size); -return ptr; +return vzalloc (size); }static inline void kmem_free_large (void *ptr) {
Signature · 6 lines
1.7.3.1.g432b3.dirty _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 41/49] fs/xfs: Use vzalloc
Quoted 13 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>--- fs/xfs/linux-2.6/kmem.h | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)fs/xfs/linux-2.6/kmem.h +0
-0@@ -61,12 +61,7 @@ extern void kmem_free(const void *);static inline void *kmem_zalloc_large (size_t size) {
fs/xfs/linux-2.6/kmem.h extern void kmem_free(const void *); · line 67
Quoted 10 lines
fs/xfs/linux-2.6/kmem.h +1
-6-void *ptr; - - ptr =vmalloc (size); -if (ptr) -memset (ptr,0 , size); -return ptr; +return vzalloc (size); }static inline void kmem_free_large (void *ptr) {
Looks good to me.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 42/49 include/linux/coda_linux.h: Use vzalloc
In reply to Christoph Lameter--- include/linux/coda_linux.h | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-)
include/linux/coda_linux.h +16 -10
@@ -55,19 +55,25 @@ unsigned short coda_flags_to_cflags(unsigned short);void coda_sysctl_init (void );void coda_sysctl_clean (void ); -#define CODA_ALLOC (ptr, cast, size) do { \ - if (size < PAGE_SIZE) \ - ptr = kmalloc((unsigned long) size, GFP_KERNEL); \ - else \ - ptr = (cast)vmalloc((unsigned long) size); \ - if (!ptr) \ - printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ - else memset( ptr, 0, size ); \ +#define CODA_ALLOC (ptr, cast, size) \ +do { \ + if (size < PAGE_SIZE) \ + ptr = kzalloc((unsigned long) size, GFP_KERNEL); \ + else \ + ptr = vzalloc((unsigned long) size); \ + if (!ptr) \ + printk(KERN_ERR "kernel malloc returns 0 at %s:%d\n", \ + __FILE__, __LINE__); \ } while (0) -#define CODA_FREE (ptr,size) \ - do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0) +#define CODA_FREE (ptr, size) \ +do { \ + if (size < PAGE_SIZE) \ + kfree((ptr)); \ + else \ + vfree((ptr)); \ +} while (0)/* inode to cnode access functions */
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 43/49 kernel: Use vzalloc
In reply to Christoph Lameter--- kernel/profile.c | 6 ++---- kernel/relay.c | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-)
kernel/profile.c +2 -4
@@ -126,11 +126,9 @@ int __ref profile_init(void)if (prof_buffer)return 0 ; - prof_buffer =vmalloc (buffer_bytes); -if (prof_buffer) { -memset (prof_buffer,0 , buffer_bytes); + prof_buffer =vzalloc (buffer_bytes); +if (prof_buffer)return 0 ; - }free_cpumask_var (prof_cpu_mask);return -ENOMEM ;
kernel/relay.c +1 -3
@@ -74,9 +74,7 @@ static struct page **relay_alloc_page_array(unsigned int n_pages)size_t pa_size = n_pages *sizeof (struct page *);if (pa_size >PAGE_SIZE ) { - array =vmalloc (pa_size); -if (array) -memset (array,0 , pa_size); + array =vzalloc (pa_size); }else { array =kzalloc (pa_size,GFP_KERNEL ); }
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 44/49 mm: Use vzalloc
In reply to Christoph Lameter--- mm/memcontrol.c | 5 ++--- mm/page_cgroup.c | 3 +-- mm/percpu.c | 8 ++------ mm/swapfile.c | 3 +-- 4 files changed, 6 insertions(+), 13 deletions(-)
mm/memcontrol.c +2 -3
@@ -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 )
mm/page_cgroup.c +1 -2
@@ -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;
mm/percpu.c +2 -6
@@ -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); }/**
mm/swapfile.c +1 -2
@@ -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++) {
Signature · 8 lines
1.7.3.1.g432b3.dirty -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. 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:"[email protected]"> [email protected] </a>
PATCH 45/49 net/core/pktgen.c: Use vzalloc
In reply to Christoph Lameter--- net/core/pktgen.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
net/core/pktgen.c +1 -2
@@ -3706,13 +3706,12 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)return -ENOMEM ;strcpy (pkt_dev->odevname, ifname); - pkt_dev->flows =vmalloc_node (MAX_CFLOWS *sizeof (struct flow_state ), + pkt_dev->flows =vzalloc_node (MAX_CFLOWS *sizeof (struct flow_state ), node);if (pkt_dev->flows ==NULL ) {kfree (pkt_dev);return -ENOMEM ; } -memset (pkt_dev->flows,0 ,MAX_CFLOWS *sizeof (struct flow_state )); pkt_dev->removal_mark =0 ; pkt_dev->min_pkt_size =ETH_ZLEN ;
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 46/49 net/netfilter: Use vzalloc
In reply to Christoph Lameter--- net/netfilter/x_tables.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
net/netfilter/x_tables.c +2 -3
@@ -753,12 +753,11 @@ static int xt_jumpstack_alloc(struct xt_table_info *i) size =sizeof (void **) * nr_cpu_ids;if (size >PAGE_SIZE ) - i->jumpstack =vmalloc (size); + i->jumpstack =vzalloc (size);else - i->jumpstack =kmalloc (size,GFP_KERNEL ); + i->jumpstack =kzalloc (size,GFP_KERNEL );if (i->jumpstack ==NULL )return -ENOMEM ; -memset (i->jumpstack,0 , size); i->stacksize *= xt_jumpstack_multiplier; size =sizeof (void *) * i->stacksize;
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 46/49] net/netfilter: Use vzalloc
Quoted 4 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>--- net/netfilter/x_tables.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
So many 'vzalloc' patches for net tree...
I had _one_ patch, waiting that David actually had vzalloc() in its tree before sending it.
Given Jesper Juhl was doing this work, could you please take another one, please ?
For example, explaining him how to use other tools than "bash+egrep +manual inspection" as he mentioned in a previous mail.
Really Joe, your behavior should be smarter than that.
Thanks
Re: [PATCH 46/49] net/netfilter: Use vzalloc
Quoted 2 lines · Eric Dumazet
I had _one_ patch, waiting that David actually had
vzalloc()in its tree before sending it.
Fine by me, use yours.
Quoted 4 lines
Given Jesper Juhl was doing this work, could you please take another one, please ?
For example, explaining him how to use other tools than "bash+egrep +manual inspection" as he mentioned in a previous mail.
Jesper Juhl was both pointed at the cocci docs and given a cocci script. He said he'd investigate it when he could. I trust he will get to it.
I think that for this sort of patchset, grep and manual inspection works just as well as spatch and likely better because a simple cocci script doesn't transform code like:
if (size > PAGE_SIZE) ptr = vmalloc(size); else ptr = kmalloc(size, GFP); if (ptr) memset(ptr, 0, size);
I did say in the 00 cover that this was broken up just to cc the maintainers of each block.
I also think a single rolled-up single patch is good.
I believe Jiri Kosina can easily apply all these individual patches as a single patch if he chooses.
Re: [PATCH 46/49] net/netfilter: Use vzalloc
Quoted 5 lines · Joe Perches
Quoted 2 lines · Eric Dumazet
I had _one_ patch, waiting that David actually had
vzalloc()in its tree before sending it.Fine by me, use yours.
I dont care at all, only to say that David tree was not ready yet.
Quoted 10 lines
Quoted 5 lines
Given Jesper Juhl was doing this work, could you please take another one, please ?
For example, explaining him how to use other tools than "bash+egrep +manual inspection" as he mentioned in a previous mail.Jesper Juhl was both pointed at the cocci docs and given a cocci script. He said he'd investigate it when he could. I trust he will get to it.
Yes, yet you posted patches, knowing he was working on the _same_ subject.
I remember other occurrences of such behavior.
I find this behavior very unfriendly, time consuming, and not useful.
We try to work together, to increase our common knowledge, not to throw a bunch of patches "just because I know better than you"
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 46/49] net/netfilter: Use vzalloc
Quoted 16 lines · Eric Dumazet
Quoted 5 lines · Joe Perches
Quoted 2 lines · Eric Dumazet
I had _one_ patch, waiting that David actually had
vzalloc()in its tree before sending it.Fine by me, use yours.
I dont care at all, only to say that David tree was not ready yet.
Quoted 6 lines
Quoted 5 lines
Given Jesper Juhl was doing this work, could you please take another one, please ?
For example, explaining him how to use other tools than "bash+egrep +manual inspection" as he mentioned in a previous mail.
Quoted 8 lines
Quoted 4 lines
Jesper Juhl was both pointed at the cocci docs and given a cocci script. He said he'd investigate it when he could. I trust he will get to it.
Yes, yet you posted patches, knowing he was working on the _same_ subject.
And I will get to look at cocci and spatch, they are definately tools that I want in my arsenal.
Quoted 7 lines
I remember other occurrences of such behavior.
I find this behavior very unfriendly, time consuming, and not useful.
We try to work together, to increase our common knowledge, not to throw a bunch of patches "just because I know better than you"
To be completely honest, I did get the feeling that the task I'd set for myself and was having fun doing in the little spare time I have got hijacked and I did waste about an hour and a half doing a few more cleanups before I saw the patchset on lkml.
But on the other hand, the most important thing is that it gets done, not who ends up doing it - especially since it's such a trivial cleanup, so I choose to see it as my initial patches just getting the ball rolling.
It would have been nice with at least an email along the lines of "I know how we can do all those patches in a jiffy, mind if I just go along and do that?", but I'll live. There's plenty of other stuff to do :-)
Signature · 3 lines
Jesper Juhl <[email protected]> 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
Re: [PATCH 46/49] net/netfilter: Use vzalloc
In reply to Joe PerchesQuoted 4 lines · Joe Perches
I also think a single rolled-up single patch is good.
I believe Jiri Kosina can easily apply all these individual patches as a single patch if he chooses.
I will, after this settles a little bit (the same for the WARN series). I prefer waiting a bit before applying your patches usually.
First to see what lands in linux-next through maintainer's trees, second to gather Acks.
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.
Re: [PATCH 46/49] net/netfilter: Use vzalloc
Quoted 8 lines · Jiri Kosina
Quoted 3 lines · Joe Perches
I also think a single rolled-up single patch is good.
I believe Jiri Kosina can easily apply all these individual patches as a single patch if he chooses.I will, after this settles a little bit (the same for the WARN series). I prefer waiting a bit before applying your patches usually. First to see what lands in linux-next through maintainer's trees, second to gather Acks.
I think that's the right way to do these sorts of trivial changes too.
Individual patches cc'd to maintainers for feedback, improvement, acks or to be directly applied to their trees, followed by a longish delay before any unapplied patches are taken up as a single patch by your trivial queue.
Thanks for doing that work Jiri.
PATCH 47/49 net/rds: Use vzalloc
In reply to Christoph Lameter--- net/rds/ib_cm.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
net/rds/ib_cm.c +2 -4
@@ -374,23 +374,21 @@ static int rds_ib_setup_qp(struct rds_connection *conn) goto out; } - ic->i_sends =vmalloc_node (ic->i_send_ring.w_nr *sizeof (struct rds_ib_send_work ), + ic->i_sends =vzalloc_node (ic->i_send_ring.w_nr *sizeof (struct rds_ib_send_work ),ibdev_to_node (dev));if (!ic->i_sends) { ret = -ENOMEM ;rdsdebug ("send allocation failed\n" ); goto out; } -memset (ic->i_sends,0 , ic->i_send_ring.w_nr *sizeof (struct rds_ib_send_work )); - ic->i_recvs =vmalloc_node (ic->i_recv_ring.w_nr *sizeof (struct rds_ib_recv_work ), + ic->i_recvs =vzalloc_node (ic->i_recv_ring.w_nr *sizeof (struct rds_ib_recv_work ),ibdev_to_node (dev));if (!ic->i_recvs) { ret = -ENOMEM ;rdsdebug ("recv allocation failed\n" ); goto out; } -memset (ic->i_recvs,0 , ic->i_recv_ring.w_nr *sizeof (struct rds_ib_recv_work ));rds_ib_recv_init_ack (ic);
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 48/49 sound/oss/dev_table.c: Use vzalloc
In reply to Christoph Lameter--- sound/oss/dev_table.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
sound/oss/dev_table.c +2 -4
@@ -71,7 +71,7 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,if (sound_nblocks >=MAX_MEM_BLOCKS ) sound_nblocks =MAX_MEM_BLOCKS -1 ; - op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] =vmalloc (sizeof (struct audio_operations ))); + op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] =vzalloc (sizeof (struct audio_operations ))); sound_nblocks++;if (sound_nblocks >=MAX_MEM_BLOCKS ) sound_nblocks =MAX_MEM_BLOCKS -1 ;
@@ -81,7 +81,6 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,sound_unload_audiodev (num);return -(ENOMEM ); } -memset ((char *) op,0 ,sizeof (struct audio_operations ));init_waitqueue_head (&op->in_sleeper);init_waitqueue_head (&op->out_sleeper);init_waitqueue_head (&op->poll_sleeper);
@@ -128,7 +127,7 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,/* FIXME: This leaks a mixer_operations struct every time its called until you unload sound! */ - op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] =vmalloc (sizeof (struct mixer_operations ))); + op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] =vzalloc (sizeof (struct mixer_operations ))); sound_nblocks++;if (sound_nblocks >=MAX_MEM_BLOCKS ) sound_nblocks =MAX_MEM_BLOCKS -1 ;
@@ -137,7 +136,6 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,printk (KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n" , name);return -ENOMEM ; } -memset ((char *) op,0 ,sizeof (struct mixer_operations ));memcpy ((char *) op, (char *) driver, driver_size);strlcpy (op->name, name,sizeof (op->name));
Signature · 1 line
1.7.3.1.g432b3.dirty
Takashi Iwai
AppliedRe: [PATCH 48/49] sound/oss/dev_table.c: Use vzalloc
At Thu, 4 Nov 2010 20:08:12 -0700,
Quoted 2 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>
Thanks, applied.
[Sorry to be late, this has been already applied in my tree but this
reply mail wasn't triggered to be sent out until now...]
Takashi
Quoted 45 lines
--- sound/oss/dev_table.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)sound/oss/dev_table.c +2
-4@@ -71,7 +71,7 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,if (sound_nblocks >=MAX_MEM_BLOCKS ) sound_nblocks =MAX_MEM_BLOCKS -1 ; - op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] =vmalloc (sizeof (struct audio_operations ))); + op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] =vzalloc (sizeof (struct audio_operations ))); sound_nblocks++;if (sound_nblocks >=MAX_MEM_BLOCKS ) sound_nblocks =MAX_MEM_BLOCKS -1 ;@@ -81,7 +81,6 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,sound_unload_audiodev (num);return -(ENOMEM ); } -memset ((char *) op,0 ,sizeof (struct audio_operations ));init_waitqueue_head (&op->in_sleeper);init_waitqueue_head (&op->out_sleeper);init_waitqueue_head (&op->poll_sleeper);@@ -128,7 +127,7 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,/* FIXME: This leaks a mixer_operations struct every time its called until you unload sound! */ - op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] =vmalloc (sizeof (struct mixer_operations ))); + op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] =vzalloc (sizeof (struct mixer_operations ))); sound_nblocks++;if (sound_nblocks >=MAX_MEM_BLOCKS ) sound_nblocks =MAX_MEM_BLOCKS -1 ;@@ -137,7 +136,6 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,printk (KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n" , name);return -ENOMEM ; } -memset ((char *) op,0 ,sizeof (struct mixer_operations ));memcpy ((char *) op, (char *) driver, driver_size);strlcpy (op->name, name,sizeof (op->name));Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 49/49 virt/kvm/kvm_main.c: Use vzalloc
In reply to Christoph Lameter--- virt/kvm/kvm_main.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
virt/kvm/kvm_main.c +3 -10
@@ -604,13 +604,10 @@ int __kvm_set_memory_region(struct kvm *kvm,/* Allocate if a slot is being created */ #ifndef CONFIG_S390 if (npages && !new.rmap) { - new.rmap =vmalloc (npages *sizeof (*new.rmap)); - + new.rmap =vzalloc (npages *sizeof (*new.rmap));if (!new.rmap) goto out_free; -memset (new.rmap,0 , npages *sizeof (*new.rmap)); - new.user_alloc = user_alloc; new.userspace_addr = mem->userspace_addr; }
@@ -633,14 +630,11 @@ int __kvm_set_memory_region(struct kvm *kvm, >> KVM_HPAGE_GFN_SHIFT(level)); lpages -= base_gfn >>KVM_HPAGE_GFN_SHIFT (level); - new.lpage_info[i] =vmalloc (lpages *sizeof (*new.lpage_info[i])); + new.lpage_info[i] =vzalloc (lpages *sizeof (*new.lpage_info[i]));if (!new.lpage_info[i]) goto out_free; -memset (new.lpage_info[i],0 , - lpages *sizeof (*new.lpage_info[i])); -if (base_gfn & (KVM_PAGES_PER_HPAGE (level) -1 )) new.lpage_info[i][0 ].write_count =1 ;if ((base_gfn+npages) & (KVM_PAGES_PER_HPAGE (level) -1 ))
@@ -663,10 +657,9 @@ skip_lpage:if ((new.flags &KVM_MEM_LOG_DIRTY_PAGES ) && !new.dirty_bitmap) {unsigned long dirty_bytes =kvm_dirty_bitmap_bytes (&new); - new.dirty_bitmap =vmalloc (dirty_bytes); + new.dirty_bitmap =vzalloc (dirty_bytes);if (!new.dirty_bitmap) goto out_free; -memset (new.dirty_bitmap,0 , dirty_bytes);/* destroy any largepage mappings for dirty tracking */ if (old.npages) flush_shadow =1 ;
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 49/49] virt/kvm/kvm_main.c: Use vzalloc
virt/kvm/kvm_main.c
Quoted 6 lines · Joe Perches
Signed-off-by Joe Perches<[email protected]>--- virt/kvm/kvm_main.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)virt/kvm/kvm_main.c +0
-0
Already changed to vzalloc(), see kvm.git.
Takuya
Quoted 46 lines
index 5225052..c2a08e6e 100644
virt/kvm/kvm_main.c +3
-10@@ -604,13 +604,10 @@ int __kvm_set_memory_region(struct kvm *kvm,/* Allocate if a slot is being created */ #ifndef CONFIG_S390 if (npages&& !new.rmap) { - new.rmap =vmalloc (npages *sizeof (*new.rmap)); - + new.rmap =vzalloc (npages *sizeof (*new.rmap));if (!new.rmap) goto out_free; -memset (new.rmap,0 , npages *sizeof (*new.rmap)); - new.user_alloc = user_alloc; new.userspace_addr = mem->userspace_addr; }@@ -633,14 +630,11 @@ int __kvm_set_memory_region(struct kvm *kvm, >> KVM_HPAGE_GFN_SHIFT(level)); lpages -= base_gfn>>KVM_HPAGE_GFN_SHIFT (level); - new.lpage_info[i] =vmalloc (lpages *sizeof (*new.lpage_info[i])); + new.lpage_info[i] =vzalloc (lpages *sizeof (*new.lpage_info[i]));if (!new.lpage_info[i]) goto out_free; -memset (new.lpage_info[i],0 , - lpages *sizeof (*new.lpage_info[i])); -if (base_gfn& (KVM_PAGES_PER_HPAGE (level) -1 )) new.lpage_info[i][0 ].write_count =1 ;if ((base_gfn+npages)& (KVM_PAGES_PER_HPAGE (level) -1 ))@@ -663,10 +657,9 @@ skip_lpage:if ((new.flags&KVM_MEM_LOG_DIRTY_PAGES )&& !new.dirty_bitmap) {unsigned long dirty_bytes =kvm_dirty_bitmap_bytes (&new); - new.dirty_bitmap =vmalloc (dirty_bytes); + new.dirty_bitmap =vzalloc (dirty_bytes);if (!new.dirty_bitmap) goto out_free; -memset (new.dirty_bitmap,0 , dirty_bytes);/* destroy any largepage mappings for dirty tracking */ if (old.npages) flush_shadow =1 ;
Re: [PATCH 49/49] virt/kvm/kvm_main.c: Use vzalloc
Quoted 9 lines · Takuya Yoshikawa
virt/kvm/kvm_main.c
Quoted 6 lines · Joe Perches
Signed-off-by Joe Perches<[email protected]>--- virt/kvm/kvm_main.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)virt/kvm/kvm_main.c +0
-0Already changed to
vzalloc(), see kvm.git.
Thanks. No worries.
fyi: the kvm git isn't in MAINTAINERS.
Perhaps something like this is appropriate
--- MAINTAINERS | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
MAINTAINERS +1 -0
@@ -3443,6 +3443,7 @@ M: Avi Kivity <[email protected]> M: Marcelo Tosatti <[email protected]> L: [email protected] W: http://kvm.qumranet.com +T: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git S: Supported F: Documentation/*/kvm.txt F: arch/*/kvm/
PATCH v2 36/49 drivers/video: Use vzalloc
In reply to Christoph Lameter---
V2 - Fixed vmalloc/vzalloc typo
Thanks to Dave Young for noticing.
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 +-- 5 files changed, 7 insertions(+), 14 deletions(-)
drivers/video/arcfb.c +2 -3
@@ -515,11 +515,10 @@ static int __devinit arcfb_probe(struct platform_device *dev)/* We need a flat backing store for the Arc's less-flat actual paged framebuffer */ -if (!(videomemory =vmalloc (videomemorysize))) + videomemory =vzalloc (videomemorysize); +if (!videomemory)return retval; -memset (videomemory,0 , videomemorysize); - info =framebuffer_alloc (sizeof (struct arcfb_par ), &dev->dev);if (!info) goto err;
drivers/video/broadsheetfb.c +1 -3
@@ -1101,12 +1101,10 @@ static int __devinit broadsheetfb_probe(struct platform_device *dev) videomemorysize =roundup ((dpyw*dpyh),PAGE_SIZE ); - videomemory =vmalloc (videomemorysize); + videomemory =vzalloc (videomemorysize);if (!videomemory) goto err_fb_rel; -memset (videomemory,0 , videomemorysize); - info->screen_base = (char *)videomemory; info->fbops = &broadsheetfb_ops;
drivers/video/hecubafb.c +2 -3
@@ -231,11 +231,10 @@ static int __devinit hecubafb_probe(struct platform_device *dev) videomemorysize = (DPY_W *DPY_H )/8 ; -if (!(videomemory =vmalloc (videomemorysize))) + videomemory =vzalloc (videomemorysize); +if (!videomemory)return retval; -memset (videomemory,0 , videomemorysize); - info =framebuffer_alloc (sizeof (struct hecubafb_par ), &dev->dev);if (!info) goto err_fballoc;
drivers/video/metronomefb.c +1 -3
@@ -628,12 +628,10 @@ static int __devinit metronomefb_probe(struct platform_device *dev)/* we need to add a spare page because our csum caching scheme walks * to the end of the page */ videomemorysize =PAGE_SIZE + (fw * fh); - videomemory =vmalloc (videomemorysize); + videomemory =vzalloc (videomemorysize);if (!videomemory) goto err_fb_rel; -memset (videomemory,0 , videomemorysize); - info->screen_base = (char __force __iomem *)videomemory; info->fbops = &metronomefb_ops;
drivers/video/xen-fbfront.c +1 -2
@@ -395,10 +395,9 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,spin_lock_init (&info->dirty_lock);spin_lock_init (&info->resize_lock); - info->fb =vmalloc (fb_size); + info->fb =vzalloc (fb_size);if (info->fb ==NULL ) goto error_nomem; -memset (info->fb,0 , fb_size); info->nr_pages = (fb_size +PAGE_SIZE -1 ) >>PAGE_SHIFT ;
Signature · 1 line
1.7.3.1.g432b3.dirty
Quoted 5 lines · jovi zhang
Quoted 4 lines · Christoph Lameter
Quoted 1 line · Jesper Juhl
On Sun, 31 Oct 2010, Balbir Singh wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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. :)
Signature · 1 line
Live like a child, think like the god.
Quoted 6 lines · Jesper Juhl
Hi,
We can avoid doing a memset in
swap_cgroup_swapon()by usingvzalloc().Signed-off-by Jesper Juhl <[email protected]>