RDMA/efa: Use __GFP_RETRY_MAYFAIL for ring allocations
Subsystems (2)
Michael Margolin
maintainerPATCH 1/1 RDMA/efa: Use __GFP_RETRY_MAYFAIL for ring allocations
RQ and CQ ring buffers require physically contiguous memory. On systems under memory pressure, high-order allocations can fail even when sufficient free memory exists because the allocator gives up after a single reclaim and compaction attempt for costly-order requests that lack __GFP_RETRY_MAYFAIL.
Add __GFP_RETRY_MAYFAIL to the GFP flags in efa_zalloc_mapped() to allow retries with escalating compaction priority and release of highatomic reserves before giving up.
--- drivers/infiniband/hw/efa/efa_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/efa/efa_verbs.c +1 -1
@@ -190,7 +190,7 @@ static void *efa_zalloc_mapped(struct efa_dev *dev, dma_addr_t *dma_addr, {void *addr; - addr =alloc_pages_exact (size,GFP_KERNEL | __GFP_ZERO); + addr =alloc_pages_exact (size,GFP_KERNEL | __GFP_ZERO | __GFP_RETRY_MAYFAIL);if (!addr)return NULL ;
Signature · 1 line
2.47.3
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines
RQ and CQ ring buffers require physically contiguous memory. On systems under memory pressure, high-order allocations can fail even when sufficient free memory exists because the allocator gives up after a single reclaim and compaction attempt for costly-order requests that lack
__GFP_RETRY_MAYFAIL.
Quoted 7 lines
Add
__GFP_RETRY_MAYFAILto the GFP flags inefa_zalloc_mapped()to allow retries with escalating compaction priority and release of highatomic reserves before giving up.Reviewed-by Firas Jahjah <[email protected]>Reviewed-by Yonatan Nachum <[email protected]>Signed-off-by Michael Margolin <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 5 lines · Michael Margolin
RQ and CQ ring buffers require physically contiguous memory. On systems under memory pressure, high-order allocations can fail even when sufficient free memory exists because the allocator gives up after a single reclaim and compaction attempt for costly-order requests that lack
__GFP_RETRY_MAYFAIL.
What sizes did you see fail, and in which flow?
Thanks
Quoted 28 lines
Add
__GFP_RETRY_MAYFAILto the GFP flags inefa_zalloc_mapped()to allow retries with escalating compaction priority and release of highatomic reserves before giving up.Reviewed-by Firas Jahjah <[email protected]>Reviewed-by Yonatan Nachum <[email protected]>Signed-off-by Michael Margolin <[email protected]>--- drivers/infiniband/hw/efa/efa_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/hw/efa/efa_verbs.c +1
-1@@ -190,7 +190,7 @@ static void *efa_zalloc_mapped(struct efa_dev *dev, dma_addr_t *dma_addr, {void *addr; - addr =alloc_pages_exact (size,GFP_KERNEL | __GFP_ZERO); + addr =alloc_pages_exact (size,GFP_KERNEL | __GFP_ZERO | __GFP_RETRY_MAYFAIL);if (!addr)return NULL ;Signature · 1 line
2.47.3
Jason Gunthorpe
maintainerQuoted 8 lines · Leon Romanovsky
Quoted 5 lines · Michael Margolin
RQ and CQ ring buffers require physically contiguous memory. On systems under memory pressure, high-order allocations can fail even when sufficient free memory exists because the allocator gives up after a single reclaim and compaction attempt for costly-order requests that lack
__GFP_RETRY_MAYFAIL.What sizes did you see fail, and in which flow?
.. and many other drivers has spent alot of effort not having high order allocations like this because they just don't work.
Jason
Michael Margolin
maintainerQuoted 9 lines · Jason Gunthorpe
Quoted 8 lines · Leon Romanovsky
Quoted 5 lines · Michael Margolin
RQ and CQ ring buffers require physically contiguous memory. On systems under memory pressure, high-order allocations can fail even when sufficient free memory exists because the allocator gives up after a single reclaim and compaction attempt for costly-order requests that lack
__GFP_RETRY_MAYFAIL.What sizes did you see fail, and in which flow?
In the recent cases we have seen (in customer/production environment) it during order 7 (512KB) allocations for 32K entries RQ.
Quoted 4 lines
.. and many other drivers has spent alot of effort not having high order allocations like this because they just don't work.
Unfortunately we cannot support non contiguous queues in some of the devices but we are going to add this support where possible.
Michael
Quoted 1 line
Jason
Quoted 10 lines · Michael Margolin
RQ and CQ ring buffers require physically contiguous memory. On systems under memory pressure, high-order allocations can fail even when sufficient free memory exists because the allocator gives up after a single reclaim and compaction attempt for costly-order requests that lack
__GFP_RETRY_MAYFAIL.Add
__GFP_RETRY_MAYFAILto the GFP flags inefa_zalloc_mapped()to allow retries with escalating compaction priority and release of highatomic reserves before giving up.
Quoted 6 lines
Reviewed-by Firas Jahjah <[email protected]>Reviewed-by Yonatan Nachum <[email protected]>Signed-off-by Michael Margolin <[email protected]>--- drivers/infiniband/hw/efa/efa_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next, thanks
Jason