[Devel] [PATCH vz7] net/vhost: Replace kmalloc with kvmalloc for order>=3

Andrey Ryabinin aryabinin at virtuozzo.com
Tue Feb 27 11:27:31 MSK 2018



On 02/27/2018 01:27 AM, Andrei Vagin wrote:
> On Mon, Feb 26, 2018 at 03:29:51PM +0300, Oleg Babin wrote:
>> Currently we allocate more than eight pages of memory in
>> vhost_net_set_ubuf_info() function and we do not need
>> them to be physically contiguous, so it is feasible to
>> replace a call to kmalloc() with a call to kvmalloc().
> 
> I see only 6 pages
> 

Round up these 6 pages to the nearest power of two and you'l get 2^3 = 8 pages

> UIO_MAXIOV = 1024
> 
> struct ubuf_info {
>         void (*callback)(struct ubuf_info *, bool zerocopy_success);
>         void *ctx;
>         unsigned long desc;
> };
> 
> sizeof(struct ubuf_info) = 24
> 
> 1024 * 24 / 4096
> 6
> 



More information about the Devel mailing list