All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
To: Jiri Kosina <trivial-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Tom Tucker
	<tom-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>,
	Steve Wise
	<swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>,
	Roland Dreier <rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>,
	Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Hal Rosenstock
	<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Hoang-Nam Nguyen
	<hnguyen-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>,
	Christoph Raisch <raisch-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>,
	Ralph Campbell
	<infinipath-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 12/49] drivers/infiniband: Use vzalloc
Date: Thu,  4 Nov 2010 20:07:36 -0700	[thread overview]
Message-ID: <2a6dc4ae9321aef16372b34fc65ceda93190af0a.1288925424.git.joe@perches.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1011031108260.11625-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
In-Reply-To: <cover.1288925424.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>

Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 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(-)

diff --git a/drivers/infiniband/hw/amso1100/c2_rnic.c b/drivers/infiniband/hw/amso1100/c2_rnic.c
index 85cfae4..8c81992 100644
--- a/drivers/infiniband/hw/amso1100/c2_rnic.c
+++ b/drivers/infiniband/hw/amso1100/c2_rnic.c
@@ -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;
diff --git a/drivers/infiniband/hw/ehca/ipz_pt_fn.c b/drivers/infiniband/hw/ehca/ipz_pt_fn.c
index 1596e30..1898d6e 100644
--- a/drivers/infiniband/hw/ehca/ipz_pt_fn.c
+++ b/drivers/infiniband/hw/ehca/ipz_pt_fn.c
@@ -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) {
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index 765f0fc..6572b8c 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -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);
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index 6078992..ff5c6fa 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -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:
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index 7769382..fef0f42 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -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;
 }
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index f3b5039..953d285 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -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;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index bb10041..1e61104 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -352,15 +352,13 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_i
 	int 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)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 9ff7bc7..65e4e98 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -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 */
 
-- 
1.7.3.1.g432b3.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: Jiri Kosina <trivial@kernel.org>
Cc: Tom Tucker <tom@opengridcomputing.com>,
	Steve Wise <swise@opengridcomputing.com>,
	Roland Dreier <rolandd@cisco.com>,
	Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	Hoang-Nam Nguyen <hnguyen@de.ibm.com>,
	Christoph Raisch <raisch@de.ibm.com>,
	Ralph Campbell <infinipath@qlogic.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 12/49] drivers/infiniband: Use vzalloc
Date: Thu,  4 Nov 2010 20:07:36 -0700	[thread overview]
Message-ID: <2a6dc4ae9321aef16372b34fc65ceda93190af0a.1288925424.git.joe@perches.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1011031108260.11625@router.home>
In-Reply-To: <cover.1288925424.git.joe@perches.com>

Signed-off-by: Joe Perches <joe@perches.com>
---
 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(-)

diff --git a/drivers/infiniband/hw/amso1100/c2_rnic.c b/drivers/infiniband/hw/amso1100/c2_rnic.c
index 85cfae4..8c81992 100644
--- a/drivers/infiniband/hw/amso1100/c2_rnic.c
+++ b/drivers/infiniband/hw/amso1100/c2_rnic.c
@@ -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;
diff --git a/drivers/infiniband/hw/ehca/ipz_pt_fn.c b/drivers/infiniband/hw/ehca/ipz_pt_fn.c
index 1596e30..1898d6e 100644
--- a/drivers/infiniband/hw/ehca/ipz_pt_fn.c
+++ b/drivers/infiniband/hw/ehca/ipz_pt_fn.c
@@ -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) {
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index 765f0fc..6572b8c 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -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);
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index 6078992..ff5c6fa 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -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:
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index 7769382..fef0f42 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -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;
 }
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index f3b5039..953d285 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -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;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index bb10041..1e61104 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -352,15 +352,13 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_i
 	int 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)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 9ff7bc7..65e4e98 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -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 */
 
-- 
1.7.3.1.g432b3.dirty


  parent reply	other threads:[~2010-11-05  3:07 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-30 21:35 [PATCH] cgroup: Avoid a memset by using vzalloc Jesper Juhl
2010-10-30 21:35 ` Jesper Juhl
2010-10-30 23:34 ` Minchan Kim
2010-10-30 23:34   ` Minchan Kim
2010-10-31 17:33   ` Balbir Singh
2010-10-31 17:33     ` Balbir Singh
2010-11-01  5:40     ` Jesper Juhl
2010-11-01  5:40       ` Jesper Juhl
2010-11-03 14:38       ` Christoph Lameter
2010-11-03 14:38         ` Christoph Lameter
2010-11-03 15:20         ` jovi zhang
2010-11-03 15:20           ` jovi zhang
2010-11-03 15:48           ` Joe Perches
2010-11-03 15:48             ` Joe Perches
2010-11-03 16:10             ` Christoph Lameter
2010-11-03 16:10               ` Christoph Lameter
2010-11-04 21:43               ` Jesper Juhl
2010-11-04 21:43                 ` Jesper Juhl
     [not found]               ` <alpine.DEB.2.00.1011031108260.11625-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-11-04 21:43                 ` Jesper Juhl
2010-11-05  3:07                 ` [PATCH 00/49] Use vzalloc not vmalloc/kmemset Joe Perches
2010-11-05  3:07                 ` Joe Perches [this message]
2010-11-05  3:07                   ` [PATCH 12/49] drivers/infiniband: Use vzalloc Joe Perches
     [not found]                   ` <2a6dc4ae9321aef16372b34fc65ceda93190af0a.1288925424.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2011-01-12 19:12                     ` Roland Dreier
2011-01-12 19:12                       ` Roland Dreier
2010-11-05  3:08                 ` [PATCH 44/49] mm: " Joe Perches
2010-11-05  3:07               ` [PATCH 00/49] Use vzalloc not vmalloc/kmemset Joe Perches
2010-11-05  3:07                 ` Joe Perches
2010-11-05  3:07                 ` Joe Perches
2010-11-05  3:07                 ` Joe Perches
2010-11-05  3:07                 ` Joe Perches
2010-11-05  3:07                 ` [PATCH 01/49] arch/ia64: Use vzalloc Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05  3:07                 ` [PATCH 02/49] arch/mips: " Joe Perches
2010-11-05 10:51                   ` Ralf Baechle
2010-11-05  3:07                 ` [PATCH 03/49] arch/powerpc: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05 13:08                   ` [Cbe-oss-dev] " Jeremy Kerr
2010-11-05 13:08                     ` Jeremy Kerr
2010-11-05 13:08                     ` Jeremy Kerr
2010-11-05  3:07                 ` [PATCH 04/49] arch/s390: " Joe Perches
2010-11-05  3:07                 ` [PATCH 05/49] arch/x86: " Joe Perches
2010-11-05  4:22                   ` Takuya Yoshikawa
2010-11-05  3:07                 ` [PATCH 06/49] crypto: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-27  8:31                   ` Herbert Xu
2010-11-27  8:31                     ` Herbert Xu
2010-11-05  3:07                 ` [PATCH 07/49] drivers/atm: " Joe Perches
2010-11-05  3:07                 ` [PATCH 08/49] drivers/block: " Joe Perches
2010-11-05  3:07                 ` [PATCH 09/49] drivers/char: " Joe Perches
2010-11-05  3:07                 ` [PATCH 10/49] drivers/gpu: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05  9:29                   ` Thomas Hellstrom
2010-11-05  3:07                 ` [PATCH 11/49] drivers/hid: " Joe Perches
2010-11-05  3:07                 ` [PATCH 13/49] drivers/isdn: " Joe Perches
2010-11-05  3:07                 ` [PATCH 14/49] drivers/md: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2011-01-17 20:28                   ` Mike Snitzer
2010-11-05  3:07                 ` [PATCH 15/49] drivers/media: " Joe Perches
2010-11-05  3:07                 ` [PATCH 16/49] drivers/mtd: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-13 11:19                   ` Artem Bityutskiy
2010-11-13 11:19                     ` Artem Bityutskiy
2010-11-05  3:07                 ` [PATCH 17/49] drivers/net/cxgb3: " Joe Perches
2010-11-05  3:07                 ` [PATCH 18/49] drivers/net/cxgb4: " Joe Perches
2010-11-05  3:07                 ` [PATCH 19/49] drivers/net/e1000: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05  3:07                 ` [PATCH 20/49] drivers/net/e1000e: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05  3:07                 ` [PATCH 21/49] drivers/net/ehea: " Joe Perches
2010-11-05  3:07                 ` [PATCH 22/49] drivers/net/igb: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05  3:07                 ` [PATCH 23/49] drivers/net/igbvf: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05 11:58                   ` Rose, Gregory V
2010-11-05 11:58                     ` Rose, Gregory V
2010-11-05  3:07                 ` [PATCH 24/49] drivers/net/ixgb: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05  3:07                 ` [PATCH 25/49] drivers/net/ixgbe: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05  3:07                 ` [PATCH 26/49] drivers/net/ixgbevf: " Joe Perches
2010-11-05  3:07                   ` Joe Perches
2010-11-05 11:59                   ` Rose, Gregory V
2010-11-05 11:59                     ` Rose, Gregory V
2010-11-05  3:07                 ` [PATCH 27/49] drivers/net/netxen: " Joe Perches
2010-11-05  5:18                   ` Amit Salecha
2010-11-05  3:07                 ` [PATCH 28/49] drivers/net/pch_gbe: " Joe Perches
2010-11-05  3:07                 ` [PATCH 29/49] drivers/net/qlcnic: " Joe Perches
2010-11-05  3:07                 ` [PATCH 30/49] drivers/net/sfc: " Joe Perches
2010-11-05  3:07                 ` [PATCH 31/49] drivers/net/vxge: " Joe Perches
2010-11-05  3:07                 ` [PATCH 32/49] drivers/net/bnx2.c: " Joe Perches
2010-11-05  3:07                 ` [PATCH 33/49] drivers/s390: " Joe Perches
2010-11-05  3:07                 ` [PATCH 34/49] drivers/scsi: " Joe Perches
2010-11-05  3:07                 ` [PATCH 35/49] drivers/staging: " Joe Perches
2010-11-05  3:08                 ` [PATCH 36/49] drivers/video: " Joe Perches
2010-11-05  5:27                   ` Dave Young
2010-11-05  5:31                     ` Joe Perches
2010-11-08 16:43                   ` Konrad Rzeszutek Wilk
2010-11-05  3:08                 ` [PATCH 37/49] fs/ext4: " Joe Perches
2010-11-05  7:02                   ` Andreas Dilger
2010-11-05  7:18                     ` [PATCH V2 " Joe Perches
2010-12-20  3:22                       ` Ted Ts'o
2010-11-05  3:08                 ` [PATCH 38/49] fs/jffs2: " Joe Perches
2010-11-05  3:08                   ` Joe Perches
2010-11-13 11:19                   ` Artem Bityutskiy
2010-11-13 11:19                     ` Artem Bityutskiy
2010-11-05  3:08                 ` [PATCH 39/49] fs/reiserfs: " Joe Perches
2010-11-05  3:08                 ` [PATCH 40/49] fs/udf: " Joe Perches
2010-11-05  9:11                   ` Jan Kara
2010-11-05  9:15                     ` Peter Bortas
2010-11-05  9:30                       ` Jan Kara
2010-11-05  3:08                 ` [PATCH 41/49] fs/xfs: " Joe Perches
2010-11-05  3:08                   ` Joe Perches
2010-11-05 17:09                   ` Alex Elder
2010-11-05 17:09                     ` Alex Elder
2010-11-05  3:08                 ` [PATCH 42/49] include/linux/coda_linux.h: " Joe Perches
2010-11-05  3:08                 ` [PATCH 43/49] kernel: " Joe Perches
2010-11-05  3:08                 ` [PATCH 44/49] mm: " Joe Perches
2010-11-05  3:08                   ` Joe Perches
2010-11-05  3:08                 ` [PATCH 45/49] net/core/pktgen.c: " Joe Perches
2010-11-05  3:08                 ` [PATCH 46/49] net/netfilter: " Joe Perches
2010-11-05  6:30                   ` Eric Dumazet
2010-11-05  6:55                     ` Joe Perches
2010-11-05  7:16                       ` Eric Dumazet
2010-11-05  7:16                         ` Eric Dumazet
2010-11-05 17:01                         ` Jesper Juhl
2010-11-05 15:10                       ` Jiri Kosina
2010-11-05 15:25                         ` Joe Perches
2010-11-05  3:08                 ` [PATCH 47/49] net/rds: " Joe Perches
2010-11-05  3:08                 ` [PATCH 48/49] sound/oss/dev_table.c: " Joe Perches
2010-11-22  6:59                   ` Takashi Iwai
2010-11-22  6:59                     ` Takashi Iwai
2010-11-05  3:08                 ` [PATCH 49/49] virt/kvm/kvm_main.c: " Joe Perches
2010-11-05  4:25                   ` Takuya Yoshikawa
2010-11-05  4:44                     ` Joe Perches
2010-11-05  5:31                 ` [PATCH V2 36/49] drivers/video: " Joe Perches
2010-11-03 16:10             ` [PATCH] cgroup: Avoid a memset by using vzalloc Christoph Lameter
2010-11-03 16:37           ` Américo Wang
2010-11-03 16:37             ` Américo Wang
     [not found]           ` <AANLkTinhAQ7mNQWtjWCOWEHHwgUf+BynMM7jnVBMG32--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-03 15:31             ` Christoph Lameter
2010-11-03 15:31               ` Christoph Lameter
2010-11-03 15:31               ` Christoph Lameter
2010-11-03 15:48             ` Joe Perches
2010-11-03 16:37             ` Américo Wang
     [not found]         ` <alpine.DEB.2.00.1011030937580.10599-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-11-03 15:20           ` jovi zhang
     [not found]       ` <alpine.LNX.2.00.1011010639410.31190-h2p7t3/P30RzeRGmFJ5qR7ZzlVVXadcDXqFh9Ls21Oc@public.gmane.org>
2010-11-03 14:38         ` Christoph Lameter
     [not found]     ` <20101031173336.GA28141-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2010-11-01  5:40       ` Jesper Juhl
     [not found]   ` <AANLkTi=nMU3ezNFD8LKBhJxr6CmW6-qHY_Mo3HRt6Os0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-31 17:33     ` Balbir Singh
     [not found] ` <alpine.LNX.2.00.1010302333130.1572-h2p7t3/P30RzeRGmFJ5qR7ZzlVVXadcDXqFh9Ls21Oc@public.gmane.org>
2010-10-30 23:34   ` Minchan Kim
2010-11-01 22:00   ` Paul Menage
2010-11-01 22:00 ` Paul Menage
2010-11-01 22:00   ` Paul Menage

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2a6dc4ae9321aef16372b34fc65ceda93190af0a.1288925424.git.joe@perches.com \
    --to=joe-6d6dil74uinbdgjk7y7tuq@public.gmane.org \
    --cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=hnguyen-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
    --cc=infinipath-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=raisch-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
    --cc=rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org \
    --cc=tom-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org \
    --cc=trivial-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.