[PATCH] net: qcom/emac: Allocate buffers from local node

Subsystems: networking drivers, qualcomm emac gigabit ethernet driver, the rest

STALE3003d

3 messages, 3 authors, 2018-05-17 · open the first message on its own page

[PATCH] net: qcom/emac: Allocate buffers from local node

From: Hemanth Puranik <hidden>
Date: 2018-05-17 08:28:09

Currently we use non-NUMA aware allocation for TPD and RRD buffers,
this patch modifies to use NUMA friendly allocation.

Signed-off-by: Hemanth Puranik <redacted>
---
 drivers/net/ethernet/qualcomm/emac/emac-mac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
index 092718a..c3df86a 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
@@ -684,9 +684,10 @@ static int emac_tx_q_desc_alloc(struct emac_adapter *adpt,
 {
 	struct emac_ring_header *ring_header = &adpt->ring_header;
 	size_t size;
+	int node = dev_to_node(adpt->netdev->dev.parent);
 
 	size = sizeof(struct emac_buffer) * tx_q->tpd.count;
-	tx_q->tpd.tpbuff = kzalloc(size, GFP_KERNEL);
+	tx_q->tpd.tpbuff = kzalloc_node(size, GFP_KERNEL, node);
 	if (!tx_q->tpd.tpbuff)
 		return -ENOMEM;
 
@@ -725,9 +726,10 @@ static int emac_rx_descs_alloc(struct emac_adapter *adpt)
 	struct emac_ring_header *ring_header = &adpt->ring_header;
 	struct emac_rx_queue *rx_q = &adpt->rx_q;
 	size_t size;
+	int node = dev_to_node(adpt->netdev->dev.parent);
 
 	size = sizeof(struct emac_buffer) * rx_q->rfd.count;
-	rx_q->rfd.rfbuff = kzalloc(size, GFP_KERNEL);
+	rx_q->rfd.rfbuff = kzalloc_node(size, GFP_KERNEL, node);
 	if (!rx_q->rfd.rfbuff)
 		return -ENOMEM;
 
-- 
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

Re: [PATCH] net: qcom/emac: Allocate buffers from local node

From: Timur Tabi <hidden>
Date: 2018-05-17 11:36:20

On 5/17/18 3:28 AM, Hemanth Puranik wrote:
Currently we use non-NUMA aware allocation for TPD and RRD buffers,
this patch modifies to use NUMA friendly allocation.

Signed-off-by: Hemanth Puranik<redacted>
Acked-by: Timur Tabi <redacted>

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

Re: [PATCH] net: qcom/emac: Allocate buffers from local node

From: David Miller <davem@davemloft.net>
Date: 2018-05-17 19:57:05

From: Hemanth Puranik <redacted>
Date: Thu, 17 May 2018 13:58:00 +0530
quoted hunk
Currently we use non-NUMA aware allocation for TPD and RRD buffers,
this patch modifies to use NUMA friendly allocation.

Signed-off-by: Hemanth Puranik <redacted>
---
 drivers/net/ethernet/qualcomm/emac/emac-mac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
index 092718a..c3df86a 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
@@ -684,9 +684,10 @@ static int emac_tx_q_desc_alloc(struct emac_adapter *adpt,
 {
 	struct emac_ring_header *ring_header = &adpt->ring_header;
 	size_t size;
+	int node = dev_to_node(adpt->netdev->dev.parent);
Please order local variable declarations from longest to shortest line
(ie. reverse christmas tree layout).
quoted hunk
@@ -725,9 +726,10 @@ static int emac_rx_descs_alloc(struct emac_adapter *adpt)
 	struct emac_ring_header *ring_header = &adpt->ring_header;
 	struct emac_rx_queue *rx_q = &adpt->rx_q;
 	size_t size;
+	int node = dev_to_node(adpt->netdev->dev.parent);
Likewise.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help