Skip to contentSkip to conversation

octeontx2: use GFP_ATOMIC for QMEM dma_alloc_attrs

PATCH In review Ratheesh Kannoth 1 participant 2 messages Aug 20 – Aug 24

Subsystems (3)
lore
Share & tools
lore

Ratheesh Kannoth

author maintainer
#0 lore raw

PATCH 1/1 octeontx2: use GFP_ATOMIC for QMEM dma_alloc_attrs

From: Sunil Goutham <[email protected]>

Queue context memory for NIX/NPA and other qmem_alloc() users in the AF and NIC drivers is allocated via dma_alloc_attrs() with GFP_KERNEL. On platforms with CMA enabled, each attached interface can consume a large contiguous allocation from the CMA pool, making CMA sizing grow with the number of enabled interfaces.

Use GFP_ATOMIC for the DMA backing allocation in qmem_alloc() to reduce pressure on the CMA pool when many interfaces are enabled.

Fixes 73d33dbc0723 ("octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc")
---
 drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/common.h +1 -1
index 779413a383b7..ff5d66dd10f3 100644
@@ -61,7 +61,7 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q,
 	qmem->entry_sz = entry_sz;
 	qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN;
 	qmem->base = dma_alloc_attrs(dev, qmem->alloc_sz, &qmem->iova,
-				     GFP_KERNEL, DMA_ATTR_FORCE_CONTIGUOUS);
+				     GFP_ATOMIC, DMA_ATTR_FORCE_CONTIGUOUS);
 	if (!qmem->base)
 		return -ENOMEM;
 
Signature · 1 line
2.43.0
author maintainer
#1 lore raw
Quoted 32 lines · Ratheesh Kannoth

From: Sunil Goutham <[email protected]>

Queue context memory for NIX/NPA and other qmem_alloc() users in the AF and NIC drivers is allocated via dma_alloc_attrs() with GFP_KERNEL. On platforms with CMA enabled, each attached interface can consume a large contiguous allocation from the CMA pool, making CMA sizing grow with the number of enabled interfaces.

Use GFP_ATOMIC for the DMA backing allocation in qmem_alloc() to reduce pressure on the CMA pool when many interfaces are enabled.

Fixes 73d33dbc0723 ("octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc")
---
 drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/common.h +1 -2
index 779413a383b7..ff5d66dd10f3 100644
@@ -61,7 +61,7 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q,
 	qmem->entry_sz = entry_sz;
 	qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN;
 	qmem->base = dma_alloc_attrs(dev, qmem->alloc_sz, &qmem->iova,
-				     GFP_KERNEL, DMA_ATTR_FORCE_CONTIGUOUS);
+				     GFP_ATOMIC, DMA_ATTR_FORCE_CONTIGUOUS);
 	if (!qmem->base)
 		return -ENOMEM;
 
--
Quoted 2 lines

2.43.0

Will address sashiko comments in v2

pw-bot: changes-requested