Commit 959d2c35 authored by Carlos Bilbao's avatar Carlos Bilbao Committed by Leon Romanovsky
Browse files

RDMA/irdma: Use kvzalloc for paged memory DMA address array



Allocate array chunk->dmainfo.dmaaddrs using kvzalloc() to allow the
allocation to fall back to vmalloc when contiguous memory is unavailable
(instead of failing and logging page allocation warnings).

Acked-by: default avatarTatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: default avatarCarlos Bilbao (Lambda) <carlos.bilbao@kernel.org>
Link: https://patch.msgid.link/20260128014446.405247-1-carlos.bilbao@kernel.org


Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 87bf6469
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2239,7 +2239,7 @@ void irdma_pble_free_paged_mem(struct irdma_chunk *chunk)
				 chunk->pg_cnt);

done:
	kfree(chunk->dmainfo.dmaaddrs);
	kvfree(chunk->dmainfo.dmaaddrs);
	chunk->dmainfo.dmaaddrs = NULL;
	vfree(chunk->vaddr);
	chunk->vaddr = NULL;
@@ -2256,7 +2256,7 @@ int irdma_pble_get_paged_mem(struct irdma_chunk *chunk, u32 pg_cnt)
	u32 size;
	void *va;

	chunk->dmainfo.dmaaddrs = kzalloc(pg_cnt << 3, GFP_KERNEL);
	chunk->dmainfo.dmaaddrs = kvzalloc(pg_cnt << 3, GFP_KERNEL);
	if (!chunk->dmainfo.dmaaddrs)
		return -ENOMEM;

@@ -2277,7 +2277,7 @@ int irdma_pble_get_paged_mem(struct irdma_chunk *chunk, u32 pg_cnt)

	return 0;
err:
	kfree(chunk->dmainfo.dmaaddrs);
	kvfree(chunk->dmainfo.dmaaddrs);
	chunk->dmainfo.dmaaddrs = NULL;

	return -ENOMEM;