[PATCH 2/2] nvmet-tcp: Use kvcalloc for commands array

Christoph Hellwig hch at lst.de
Mon Nov 24 06:25:25 PST 2025


On Mon, Nov 24, 2025 at 08:49:21AM +0200, Israel Rukshin wrote:
> Replace kcalloc with kvcalloc for allocation of the commands
> array. Each command structure is 712 bytes. The array typically
> exceeds a single page, and grows much larger with high queue depths
> (e.g., commands >182KB).
> 
> kvcalloc automatically falls back to vmalloc for large or fragmented
> allocations, improving reliability. In our case, this memory is not
> aimed for DMA operations and could be safely allocated by kvcalloc.
> Using virtually contiguous memory helps to avoid allocation failures
> and out-of-memory conditions common with kcalloc on large pools.

Looks good:

Reviewed-by: Christoph Hellwig <hch at lst.de>




More information about the Linux-nvme mailing list