RE: [PATCH net-next] drivers:net: dma_alloc_coherent: use__GFP_ZERO instead of memset(, 0)

From: Abodunrin, Akeem G
Date: Fri Mar 15 2013 - 18:51:44 EST




-----Original Message-----
From: netdev-owner@xxxxxxxxxxxxxxx [mailto:netdev-owner@xxxxxxxxxxxxxxx] On Behalf Of Joe Perches
Sent: Friday, March 15, 2013 10:24 AM
To: netdev@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx; e1000-devel@xxxxxxxxxxxxxxxxxxxxx; linux-wireless@xxxxxxxxxxxxxxx; b43-dev@xxxxxxxxxxxxxxxxxxx; users@xxxxxxxxxxxxxxxxxxxxxxx
Subject: [PATCH net-next] drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0)

Reduce the number of calls required to alloc a zeroed block of memory.

Trivially reduces overall object size.

Other changes around these removals
o Neaten call argument alignment
o Remove an unnecessary OOM message after dma_alloc_coherent failure o Remove unnecessary gfp_t stack variable

Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
---
drivers/net/ethernet/aeroflex/greth.c | 8 ++------
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 ++++----
drivers/net/ethernet/broadcom/bnx2.c | 5 ++---
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 9 +++------
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 14 ++++++-------
drivers/net/ethernet/broadcom/tg3.c | 11 +++--------
drivers/net/ethernet/brocade/bna/bnad.c | 5 ++---
drivers/net/ethernet/emulex/benet/be_main.c | 14 ++++++-------
drivers/net/ethernet/faraday/ftgmac100.c | 5 ++---
drivers/net/ethernet/faraday/ftmac100.c | 8 ++++----
drivers/net/ethernet/ibm/emac/mal.c | 3 +--
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 6 ++----
drivers/net/ethernet/intel/igbvf/netdev.c | 2 --

snip...

diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index d60cd43..bea46bb 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -447,7 +447,6 @@ int igbvf_setup_tx_resources(struct igbvf_adapter *adapter,

tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size,
&tx_ring->dma, GFP_KERNEL);
-
if (!tx_ring->desc)
goto err;

@@ -488,7 +487,6 @@ int igbvf_setup_rx_resources(struct igbvf_adapter *adapter,

rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
&rx_ring->dma, GFP_KERNEL);
-
if (!rx_ring->desc)
goto err;

Hi Joe,

Your changes did not seem to make it to igbvf/netdev.c - I think instead of removing an extra line added for code clarity, you want to add:
"tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size,
&tx_ring->dma, GFP_KERNEL| __GFP_ZERO);"

Regards,
Akeem Abodunrin


--
1.8.1.2.459.gbcd45b4.dirty

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/