[PATCH] nvmet-tcp: get rid of a high-order allocation

Sagi Grimberg sagi at grimberg.me
Tue Aug 27 07:23:00 PDT 2024




On 27/08/2024 16:27, Nilay Shroff wrote:
>
> On 8/26/24 17:33, Sagi Grimberg wrote:
>> Allocating the queue commands array leads to a high order
>> allocation.
>>
>> The current size of nvmet_tcp_cmd is 704 bytes. Allocating
>> 128 of those (default queue depth) means that we are allocating
>> an array of 90K bytes. There is no reason why this will be
>> a single contiguous allocation. Change the allocation to be
>> kvcalloc instead.
> Though the description suggests using kvcalloc, the implementation
> uses vcalloc. Maybe a typo here or you want to use kvcalloc instead
> of vcalloc? In fact, either of them (kvcalloc or vcalloc) would work
> in this case.

I initially did kvcalloc, but then I thought that it'd be better to 
avoid the
high-order allocation altogether...

Unless someone has a compelling reason why to use kvcalloc, I'd stick
with vcalloc (assuming that the tls code is fine because I did not test it).



More information about the Linux-nvme mailing list