2011-05-28 17:36:59

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 00/15] treewide: Convert vmalloc/memset to vzalloc

Resubmittal of patches from November 2010 and a few new ones.

Joe Perches (15):
s390: Convert vmalloc/memset to vzalloc
x86: Convert vmalloc/memset to vzalloc
atm: Convert vmalloc/memset to vzalloc
drbd: Convert vmalloc/memset to vzalloc
char: Convert vmalloc/memset to vzalloc
isdn: Convert vmalloc/memset to vzalloc
md: Convert vmalloc/memset to vzalloc
media: Convert vmalloc/memset to vzalloc
mtd: Convert vmalloc/memset to vzalloc
scsi: Convert vmalloc/memset to vzalloc
staging: Convert vmalloc/memset to vzalloc
video: Convert vmalloc/memset to vzalloc
fs: Convert vmalloc/memset to vzalloc
mm: Convert vmalloc/memset to vzalloc
net: Convert vmalloc/memset to vzalloc

arch/s390/hypfs/hypfs_diag.c | 3 +--
arch/x86/mm/pageattr-test.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/raw.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/video/videobuf2-dma-sg.c | 8 ++------
drivers/mtd/mtdswap.c | 3 +--
drivers/s390/cio/blacklist.c | 3 +--
drivers/scsi/bfa/bfad.c | 3 +--
drivers/scsi/bfa/bfad_debugfs.c | 8 ++------
drivers/scsi/cxgbi/libcxgbi.h | 6 ++----
drivers/scsi/qla2xxx/qla_attr.c | 6 ++----
drivers/scsi/qla2xxx/qla_bsg.c | 3 +--
drivers/scsi/scsi_debug.c | 7 ++-----
drivers/staging/rts_pstor/ms.c | 3 +--
drivers/staging/rts_pstor/rtsx_chip.c | 6 ++----
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/coda/coda_linux.h | 5 ++---
fs/reiserfs/journal.c | 9 +++------
fs/reiserfs/resize.c | 4 +---
fs/xfs/linux-2.6/kmem.h | 7 +------
mm/page_cgroup.c | 3 +--
net/netfilter/x_tables.c | 5 ++---
net/rds/ib_cm.c | 6 ++----
36 files changed, 57 insertions(+), 113 deletions(-)

--
1.7.5.rc3.dirty


2011-05-28 17:37:01

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 01/15] s390: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
arch/s390/hypfs/hypfs_diag.c | 3 +--
drivers/s390/cio/blacklist.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 6023c6d..74c8f5e 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -562,10 +562,9 @@ static int dbfs_d204_create(void **data, void **data_free_ptr, size_t *size)
void *base;

buf_size = PAGE_SIZE * (diag204_buf_pages + 1) + sizeof(d204->hdr);
- base = vmalloc(buf_size);
+ base = vzalloc(buf_size);
if (!base)
return -ENOMEM;
- memset(base, 0, buf_size);
d204 = page_align_ptr(base + sizeof(d204->hdr)) - sizeof(d204->hdr);
rc = diag204_do_store(d204->buf, diag204_buf_pages);
if (rc) {
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
index 76058a5..08c6603 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -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;
--
1.7.5.rc3.dirty

2011-05-28 17:40:59

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 02/15] x86: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
arch/x86/mm/pageattr-test.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index e1d1069..b008656 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -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);
--
1.7.5.rc3.dirty

2011-05-28 17:40:23

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 03/15] atm: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
drivers/atm/idt77252.c | 11 ++++++-----
drivers/atm/lanai.c | 3 +--
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 1f8d724..8d7b663 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -3415,27 +3415,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;
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 4e8ba56..be57a14 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -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
}
--
1.7.5.rc3.dirty

2011-05-28 17:39:59

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 04/15] drbd: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
drivers/block/drbd/drbd_bitmap.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c
index f440a02..9dd03b0 100644
--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -381,15 +381,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];
--
1.7.5.rc3.dirty

2011-05-28 17:37:06

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 05/15] char: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
drivers/char/agp/backend.c | 3 +--
drivers/char/raw.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index f27d0d0..4b71647 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -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");
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index b33e8ea..b6de2c0 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -324,13 +324,12 @@ static int __init raw_init(void)
max_raw_minors = MAX_RAW_MINORS;
}

- raw_devices = vmalloc(sizeof(struct raw_device_data) * max_raw_minors);
+ raw_devices = vzalloc(sizeof(struct raw_device_data) * max_raw_minors);
if (!raw_devices) {
printk(KERN_ERR "Not enough memory for raw device structures\n");
ret = -ENOMEM;
goto error;
}
- memset(raw_devices, 0, sizeof(struct raw_device_data) * max_raw_minors);

ret = register_chrdev_region(dev, max_raw_minors, "raw");
if (ret)
--
1.7.5.rc3.dirty

2011-05-28 17:39:42

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 06/15] isdn: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
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(-)

diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 6ed82ad..6ddb795e 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -2308,11 +2308,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);
diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c
index 2877291..0c41553 100644
--- a/drivers/isdn/mISDN/dsp_core.c
+++ b/drivers/isdn/mISDN/dsp_core.c
@@ -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__);

diff --git a/drivers/isdn/mISDN/l1oip_codec.c b/drivers/isdn/mISDN/l1oip_codec.c
index bbfd1b8..5a89972 100644
--- a/drivers/isdn/mISDN/l1oip_codec.c
+++ b/drivers/isdn/mISDN/l1oip_codec.c
@@ -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) {
--
1.7.5.rc3.dirty

2011-05-28 17:37:12

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 07/15] md: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
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(-)

diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index a1f3218..b6c2b71 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -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;

diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index 95891df..be100d4 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -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)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index cb8380c..5850497 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -154,9 +154,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;
}
--
1.7.5.rc3.dirty

2011-05-28 17:37:13

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 08/15] media: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
drivers/media/video/videobuf2-dma-sg.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-sg.c b/drivers/media/video/videobuf2-dma-sg.c
index b2d9485..15d79a8 100644
--- a/drivers/media/video/videobuf2-dma-sg.c
+++ b/drivers/media/video/videobuf2-dma-sg.c
@@ -48,12 +48,10 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size)
buf->sg_desc.size = size;
buf->sg_desc.num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;

- buf->sg_desc.sglist = vmalloc(buf->sg_desc.num_pages *
+ buf->sg_desc.sglist = vzalloc(buf->sg_desc.num_pages *
sizeof(*buf->sg_desc.sglist));
if (!buf->sg_desc.sglist)
goto fail_sglist_alloc;
- memset(buf->sg_desc.sglist, 0, buf->sg_desc.num_pages *
- sizeof(*buf->sg_desc.sglist));
sg_init_table(buf->sg_desc.sglist, buf->sg_desc.num_pages);

buf->pages = kzalloc(buf->sg_desc.num_pages * sizeof(struct page *),
@@ -136,13 +134,11 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr,
last = ((vaddr + size - 1) & PAGE_MASK) >> PAGE_SHIFT;
buf->sg_desc.num_pages = last - first + 1;

- buf->sg_desc.sglist = vmalloc(
+ buf->sg_desc.sglist = vzalloc(
buf->sg_desc.num_pages * sizeof(*buf->sg_desc.sglist));
if (!buf->sg_desc.sglist)
goto userptr_fail_sglist_alloc;

- memset(buf->sg_desc.sglist, 0,
- buf->sg_desc.num_pages * sizeof(*buf->sg_desc.sglist));
sg_init_table(buf->sg_desc.sglist, buf->sg_desc.num_pages);

buf->pages = kzalloc(buf->sg_desc.num_pages * sizeof(struct page *),
--
1.7.5.rc3.dirty

2011-05-28 17:39:11

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 09/15] mtd: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
drivers/mtd/mtdswap.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index fd78853..5e5423b 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -1374,11 +1374,10 @@ static int mtdswap_init(struct mtdswap_dev *d, unsigned int eblocks,
goto revmap_fail;

eblk_bytes = sizeof(struct swap_eb)*d->eblks;
- d->eb_data = vmalloc(eblk_bytes);
+ d->eb_data = vzalloc(eblk_bytes);
if (!d->eb_data)
goto eb_data_fail;

- memset(d->eb_data, 0, eblk_bytes);
for (i = 0; i < pages; i++)
d->page_data[i] = BLOCK_UNDEF;

--
1.7.5.rc3.dirty

2011-05-28 17:37:23

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 10/15] scsi: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
drivers/scsi/bfa/bfad.c | 3 +--
drivers/scsi/bfa/bfad_debugfs.c | 8 ++------
drivers/scsi/cxgbi/libcxgbi.h | 6 ++----
drivers/scsi/qla2xxx/qla_attr.c | 6 ++----
drivers/scsi/qla2xxx/qla_bsg.c | 3 +--
drivers/scsi/scsi_debug.c | 7 ++-----
6 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 59b5e9b..fc6bb02 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -612,13 +612,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:
diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c
index 48be0c5..469b0fc 100644
--- a/drivers/scsi/bfa/bfad_debugfs.c
+++ b/drivers/scsi/bfa/bfad_debugfs.c
@@ -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_ioc_debug_fwtrc(&bfad->bfa.ioc,
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_ioc_debug_fwsave(&bfad->bfa.ioc,
fw_debug->debug_buffer,
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 9267844..e4c3d63 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -658,11 +658,9 @@ static inline u32 cxgbi_tag_nonrsvd_bits(struct cxgbi_tag_format *tformat,
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;
}

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 532313e..31634dc 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -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;
@@ -338,7 +337,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
ha->optrom_size - start : size;

ha->optrom_state = QLA_SWRITING;
- 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 update "
@@ -352,7 +351,6 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
"Staging flash region write -- 0x%x/0x%x.\n",
ha->optrom_region_start, ha->optrom_region_size));

- memset(ha->optrom_buffer, 0, ha->optrom_region_size);
break;
case 3:
if (ha->optrom_state != QLA_SWRITING)
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 8c10e2c..5f4e574 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -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;
}

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 6888b2c..185d465 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3334,12 +3334,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);

@@ -3384,7 +3383,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);
@@ -3395,8 +3394,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);
--
1.7.5.rc3.dirty

2011-05-28 17:37:21

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 11/15] staging: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
drivers/staging/rts_pstor/ms.c | 3 +--
drivers/staging/rts_pstor/rtsx_chip.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c
index 2e82587..66341df 100644
--- a/drivers/staging/rts_pstor/ms.c
+++ b/drivers/staging/rts_pstor/ms.c
@@ -2064,11 +2064,10 @@ static int ms_init_l2p_tbl(struct rtsx_chip *chip)
RTSX_DEBUGP("ms_card->segment_cnt = %d\n", ms_card->segment_cnt);

size = ms_card->segment_cnt * sizeof(struct zone_entry);
- ms_card->segment = (struct zone_entry *)vmalloc(size);
+ ms_card->segment = vzalloc(size);
if (ms_card->segment == NULL) {
TRACE_RET(chip, STATUS_FAIL);
}
- memset(ms_card->segment, 0, size);

retval = ms_read_page(chip, ms_card->boot_block, 1);
if (retval != STATUS_SUCCESS) {
diff --git a/drivers/staging/rts_pstor/rtsx_chip.c b/drivers/staging/rts_pstor/rtsx_chip.c
index 4e60780..5452069 100644
--- a/drivers/staging/rts_pstor/rtsx_chip.c
+++ b/drivers/staging/rts_pstor/rtsx_chip.c
@@ -1596,18 +1596,16 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, int l
}
RTSX_DEBUGP("dw_len = %d\n", dw_len);

- data = (u32 *)vmalloc(dw_len * 4);
+ data = vzalloc(dw_len * 4);
if (!data) {
TRACE_RET(chip, STATUS_NOMEM);
}
- memset(data, 0, dw_len * 4);

- mask = (u32 *)vmalloc(dw_len * 4);
+ mask = vzalloc(dw_len * 4);
if (!mask) {
vfree(data);
TRACE_RET(chip, STATUS_NOMEM);
}
- memset(mask, 0, dw_len * 4);

j = 0;
for (i = 0; i < len; i++) {
--
1.7.5.rc3.dirty

2011-05-28 17:38:44

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 12/15] video: Convert vmalloc/memset to vzalloc

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(-)

diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
index 3ec4923..86573e2 100644
--- a/drivers/video/arcfb.c
+++ b/drivers/video/arcfb.c
@@ -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;
diff --git a/drivers/video/broadsheetfb.c b/drivers/video/broadsheetfb.c
index ebda687..377dde3 100644
--- a/drivers/video/broadsheetfb.c
+++ b/drivers/video/broadsheetfb.c
@@ -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;

diff --git a/drivers/video/hecubafb.c b/drivers/video/hecubafb.c
index 1b94643..fbef15f 100644
--- a/drivers/video/hecubafb.c
+++ b/drivers/video/hecubafb.c
@@ -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;
diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c
index ed64edf..97d45e5 100644
--- a/drivers/video/metronomefb.c
+++ b/drivers/video/metronomefb.c
@@ -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;

diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index a20218c..beac52f 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -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.5.rc3.dirty

2011-05-28 17:38:14

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 13/15] fs: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
fs/coda/coda_linux.h | 5 ++---
fs/reiserfs/journal.c | 9 +++------
fs/reiserfs/resize.c | 4 +---
fs/xfs/linux-2.6/kmem.h | 7 +------
4 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h
index 9b0c532..7807025 100644
--- a/fs/coda/coda_linux.h
+++ b/fs/coda/coda_linux.h
@@ -59,12 +59,11 @@ void coda_sysctl_clean(void);

#define CODA_ALLOC(ptr, cast, size) do { \
if (size < PAGE_SIZE) \
- ptr = kmalloc((unsigned long) size, GFP_KERNEL); \
+ ptr = kzalloc((unsigned long) size, GFP_KERNEL); \
else \
- ptr = (cast)vmalloc((unsigned long) size); \
+ ptr = (cast)vzalloc((unsigned long) size); \
if (!ptr) \
printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
- else memset( ptr, 0, size ); \
} while (0)


diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index c5e82ec..40d8b0a 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -291,14 +291,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);
@@ -353,11 +352,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++) {
@@ -2695,14 +2693,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);
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c
index b3a94d2..cfb5196 100644
--- a/fs/reiserfs/resize.c
+++ b/fs/reiserfs/resize.c
@@ -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];

diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
index f7c8f7a..292eff1 100644
--- a/fs/xfs/linux-2.6/kmem.h
+++ b/fs/xfs/linux-2.6/kmem.h
@@ -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)
{
--
1.7.5.rc3.dirty

2011-05-28 17:37:26

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 14/15] mm: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
mm/page_cgroup.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 74ccff6..dbb28fd 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -478,11 +478,10 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
length = DIV_ROUND_UP(max_pages, SC_PER_PAGE);
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;
--
1.7.5.rc3.dirty

2011-05-28 17:37:31

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH next 15/15] net: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
net/netfilter/x_tables.c | 5 ++---
net/rds/ib_cm.c | 6 ++----
2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index b0869fe..71441b9 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -776,12 +776,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;
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index fd453dd..6ecaf78 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -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);

--
1.7.5.rc3.dirty

2011-05-28 17:48:35

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH next 12/15] video: Convert vmalloc/memset to vzalloc

Am Samstag 28 Mai 2011, 19:36:32 schrieb Joe Perches:
> diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
> index 3ec4923..86573e2 100644
> --- a/drivers/video/arcfb.c
> +++ b/drivers/video/arcfb.c
> @@ -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;
shouldn't this be vzalloc too?

> - memset(videomemory, 0, videomemorysize);
> -
> info = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev);
> if (!info)
> goto err;


Heiko

2011-05-28 18:13:37

by Joe Perches

[permalink] [raw]
Subject: [TRIVIAL PATCH V2 next 12/15] video: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <[email protected]>
---
Heiko Stübner <[email protected]> pointed out I can't type...
s/vmalloc/vmalloc/ doesn't do much.

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(-)

diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
index 3ec4923..86573e2 100644
--- a/drivers/video/arcfb.c
+++ b/drivers/video/arcfb.c
@@ -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;
diff --git a/drivers/video/broadsheetfb.c b/drivers/video/broadsheetfb.c
index ebda687..377dde3 100644
--- a/drivers/video/broadsheetfb.c
+++ b/drivers/video/broadsheetfb.c
@@ -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;

diff --git a/drivers/video/hecubafb.c b/drivers/video/hecubafb.c
index 1b94643..fbef15f 100644
--- a/drivers/video/hecubafb.c
+++ b/drivers/video/hecubafb.c
@@ -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;
diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c
index ed64edf..97d45e5 100644
--- a/drivers/video/metronomefb.c
+++ b/drivers/video/metronomefb.c
@@ -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;

diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index a20218c..beac52f 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -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;

--

2011-05-29 19:25:51

by Joe Perches

[permalink] [raw]
Subject: [tip:x86/cleanups] x86: Convert vmalloc()+memset() to vzalloc()

Commit-ID: c4d017f21328c269deba3c7acde873204fe595b5
Gitweb: http://git.kernel.org/tip/c4d017f21328c269deba3c7acde873204fe595b5
Author: Joe Perches <[email protected]>
AuthorDate: Sat, 28 May 2011 10:36:22 -0700
Committer: Ingo Molnar <[email protected]>
CommitDate: Sat, 28 May 2011 19:53:57 +0200

x86: Convert vmalloc()+memset() to vzalloc()

Signed-off-by: Joe Perches <[email protected]>
Cc: Jiri Kosina <[email protected]>
Link: http://lkml.kernel.org/r/10e35243fda0b8739c89ac32a7bdf348ec4752e1.1306603968.git.joe@perches.com
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/mm/pageattr-test.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index e1d1069..b008656 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -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);

2011-05-30 11:40:34

by Mel Gorman

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH next 12/15] video: Convert vmalloc/memset to vzalloc

On Sat, May 28, 2011 at 10:36:32AM -0700, Joe Perches wrote:
> 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(-)
>
> diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
> index 3ec4923..86573e2 100644
> --- a/drivers/video/arcfb.c
> +++ b/drivers/video/arcfb.c
> @@ -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;

This is the first commit I saw and stopped reading at this point
because this hunk is not using vzalloc. I imagine grep for ^+ and
vmalloc throughout the series would be helpful?

--
Mel Gorman
SUSE Labs

2011-05-31 14:30:28

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH V2 next 12/15] video: Convert vmalloc/memset to vzalloc

On Sat, May 28, 2011 at 11:13:33AM -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <[email protected]>

Acked-by: Konrad Rzeszutek Wilk <[email protected]> on the:

> diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
> index a20218c..beac52f 100644
> --- a/drivers/video/xen-fbfront.c
> +++ b/drivers/video/xen-fbfront.c
> @@ -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;

2011-05-31 18:20:48

by Alex Elder

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH next 13/15] fs: Convert vmalloc/memset to vzalloc

On Sat, 2011-05-28 at 10:36 -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <[email protected]>
> ---
> fs/coda/coda_linux.h | 5 ++---
> fs/reiserfs/journal.c | 9 +++------
> fs/reiserfs/resize.c | 4 +---
> fs/xfs/linux-2.6/kmem.h | 7 +------
> 4 files changed, 7 insertions(+), 18 deletions(-)
>

Acked-by: Alex Elder <[email protected]>

. . .

> diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
> index f7c8f7a..292eff1 100644
> --- a/fs/xfs/linux-2.6/kmem.h
> +++ b/fs/xfs/linux-2.6/kmem.h
> @@ -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)
> {


2011-05-31 19:47:58

by Paul Menage

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH next 14/15] mm: Convert vmalloc/memset to vzalloc

On Sat, May 28, 2011 at 10:36 AM, Joe Perches <[email protected]> wrote:
> Signed-off-by: Joe Perches <[email protected]>

Acked-by: Paul Menage <[email protected]>

> ---
> ?mm/page_cgroup.c | ? ?3 +--
> ?1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
> index 74ccff6..dbb28fd 100644
> --- a/mm/page_cgroup.c
> +++ b/mm/page_cgroup.c
> @@ -478,11 +478,10 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
> ? ? ? ?length = DIV_ROUND_UP(max_pages, SC_PER_PAGE);
> ? ? ? ?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;
> --
> 1.7.5.rc3.dirty
>
>

2011-06-01 08:40:57

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH next 09/15] mtd: Convert vmalloc/memset to vzalloc

On Sat, 2011-05-28 at 10:36 -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <[email protected]>
> ---
> drivers/mtd/mtdswap.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)

Pushed to l2-mtd-2.6.git, thanks.

--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

2011-06-02 08:28:29

by Paul Mundt

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH V2 next 12/15] video: Convert vmalloc/memset to vzalloc

On Sat, May 28, 2011 at 11:13:33AM -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <[email protected]>
> ---
> Heiko St??bner <[email protected]> pointed out I can't type...
> s/vmalloc/vmalloc/ doesn't do much.
>
> 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(-)
>
v2 applied.

2011-06-02 14:50:15

by Pablo Neira Ayuso

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH next 15/15] net: Convert vmalloc/memset to vzalloc

David,

Are you going to take this patch? it includes one chunck which is out of
netfilter scope.

Thanks.

On 28/05/11 19:36, Joe Perches wrote:
> Signed-off-by: Joe Perches <[email protected]>
> ---
> net/netfilter/x_tables.c | 5 ++---
> net/rds/ib_cm.c | 6 ++----
> 2 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
> index b0869fe..71441b9 100644
> --- a/net/netfilter/x_tables.c
> +++ b/net/netfilter/x_tables.c
> @@ -776,12 +776,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;
> diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
> index fd453dd..6ecaf78 100644
> --- a/net/rds/ib_cm.c
> +++ b/net/rds/ib_cm.c
> @@ -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);
>

2011-06-02 21:44:29

by David Miller

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH next 15/15] net: Convert vmalloc/memset to vzalloc

From: Pablo Neira Ayuso <[email protected]>
Date: Thu, 02 Jun 2011 16:49:53 +0200

> Are you going to take this patch? it includes one chunck which is out of
> netfilter scope.

I think the trivial folks submit these things via their own tree
and are only looking for ACKs from us.

Acked-by: David S. Miller <[email protected]>

2011-06-03 01:35:49

by Joe Perches

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH next 15/15] net: Convert vmalloc/memset to vzalloc

On Thu, 2011-06-02 at 14:39 -0700, David Miller wrote:
> From: Pablo Neira Ayuso <[email protected]>
> Date: Thu, 02 Jun 2011 16:49:53 +0200
> > Are you going to take this patch? it includes one chunk which is out of
> > netfilter scope.
> I think the trivial folks submit these things via their own tree
> and are only looking for ACKs from us.
> Acked-by: David S. Miller <[email protected]>

Getting trivial patches applied between the various
maintainers and the trivial tree is most often a bit
uncoordinated and haphazard.

Doing micropatches for each subsystem maintainer
does sometimes appear to be detrimental to getting
any treewide modification applied.

I've experimented with both micropatches and
treewide patches to gauge what happens.
I'm not sure either approach is better or worse.

In any case, it commonly takes several submittals
for these sort of trivial patches to get applied
either by the subtree maintainer or by Jiri.

Jiri often waits a few weeks for patches to get
picked up by any subtree maintainer before looking
at his trivial emails. Sometimes he acks what's
left, sometimes what's left just disappears into
the ethervoid waiting for the submitter to try
again.

No worries, that's just the way it is.

2011-06-03 09:39:24

by Pablo Neira Ayuso

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH next 15/15] net: Convert vmalloc/memset to vzalloc

On 02/06/11 23:39, David Miller wrote:
> From: Pablo Neira Ayuso <[email protected]>
> Date: Thu, 02 Jun 2011 16:49:53 +0200
>
>> Are you going to take this patch? it includes one chunck which is out of
>> netfilter scope.
>
> I think the trivial folks submit these things via their own tree
> and are only looking for ACKs from us.
>
> Acked-by: David S. Miller <[email protected]>

Acked-by: Pablo Neira Ayuso <[email protected]>