netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ionic: Fix allocation of q/cq info structures from device local node
@ 2023-04-07 23:36 Brett Creeley
  2023-04-09 10:52 ` Leon Romanovsky
  0 siblings, 1 reply; 8+ messages in thread
From: Brett Creeley @ 2023-04-07 23:36 UTC (permalink / raw)
  To: davem, netdev, kuba; +Cc: drivers, shannon.nelson, brett.creeley, neel.patel

Commit 116dce0ff047 ("ionic: Use vzalloc for large per-queue related
buffers") made a change to relieve memory pressure by making use of
vzalloc() due to the structures not requiring DMA mapping. However,
it overlooked that these structures are used in the fast path of the
driver and allocations on the non-local node could cause performance
degredation. Fix this by first attempting to use vzalloc_node()
using the device's local node and if that fails try again with
vzalloc().

Fixes: 116dce0ff047 ("ionic: Use vzalloc for large per-queue related buffers")
Signed-off-by: Neel Patel <neel.patel@amd.com>
Signed-off-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
---
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 24 ++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 957027e546b3..2c4e226b8cf1 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -560,11 +560,15 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
 	new->q.dev = dev;
 	new->flags = flags;
 
-	new->q.info = vzalloc(num_descs * sizeof(*new->q.info));
+	new->q.info = vzalloc_node(num_descs * sizeof(*new->q.info),
+				   dev_to_node(dev));
 	if (!new->q.info) {
-		netdev_err(lif->netdev, "Cannot allocate queue info\n");
-		err = -ENOMEM;
-		goto err_out_free_qcq;
+		new->q.info = vzalloc(num_descs * sizeof(*new->q.info));
+		if (!new->q.info) {
+			netdev_err(lif->netdev, "Cannot allocate queue info\n");
+			err = -ENOMEM;
+			goto err_out_free_qcq;
+		}
 	}
 
 	new->q.type = type;
@@ -581,11 +585,15 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
 	if (err)
 		goto err_out;
 
-	new->cq.info = vzalloc(num_descs * sizeof(*new->cq.info));
+	new->cq.info = vzalloc_node(num_descs * sizeof(*new->cq.info),
+				    dev_to_node(dev));
 	if (!new->cq.info) {
-		netdev_err(lif->netdev, "Cannot allocate completion queue info\n");
-		err = -ENOMEM;
-		goto err_out_free_irq;
+		new->cq.info = vzalloc(num_descs * sizeof(*new->cq.info));
+		if (!new->cq.info) {
+			netdev_err(lif->netdev, "Cannot allocate completion queue info\n");
+			err = -ENOMEM;
+			goto err_out_free_irq;
+		}
 	}
 
 	err = ionic_cq_init(lif, &new->cq, &new->intr, num_descs, cq_desc_size);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-04-13  6:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-07 23:36 [PATCH net] ionic: Fix allocation of q/cq info structures from device local node Brett Creeley
2023-04-09 10:52 ` Leon Romanovsky
2023-04-10 18:16   ` Brett Creeley
2023-04-11 12:47     ` Leon Romanovsky
2023-04-11 19:49       ` Jakub Kicinski
2023-04-12 16:58         ` Leon Romanovsky
2023-04-12 19:44           ` Jakub Kicinski
2023-04-13  6:43             ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).