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

Oleg Babin obabin at virtuozzo.com
Mon Feb 26 17:54:26 MSK 2018


Definitely yes, my fault. Thanks!

________________________________
From: Vasiliy Averin
Sent: Monday, February 26, 2018 3:50:54 PM
To: Oleg Babin; Andrey Ryabinin
Cc: devel at openvz.org
Subject: Re: [Devel] [PATCH vz7] net/vhost: Replace kmalloc with kvmalloc for order>=3

is it probably kfree -> kvfree required too ?

On 2018-02-26 15:29, Oleg Babin wrote:
> [This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]
>
> 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().
>
> https://jira.sw.ru/browse/PSBM-81803
> Signed-off-by: Oleg Babin <obabin at virtuozzo.com>
> ---
>  drivers/vhost/net.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 1076a46..d397ceb 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -179,8 +179,8 @@ int vhost_net_set_ubuf_info(struct vhost_net *n)
>                 zcopy = vhost_net_zcopy_mask & (0x1 << i);
>                 if (!zcopy)
>                         continue;
> -               n->vqs[i].ubuf_info = kmalloc(sizeof(*n->vqs[i].ubuf_info) *
> -                                             UIO_MAXIOV, GFP_KERNEL);
> +               n->vqs[i].ubuf_info = kvmalloc(sizeof(*n->vqs[i].ubuf_info) *
> +                                              UIO_MAXIOV, GFP_KERNEL);
>                 if  (!n->vqs[i].ubuf_info)
>                         goto err;
>         }
> --
> 1.8.3.1
>
> _______________________________________________
> Devel mailing list
> Devel at openvz.org
> https://lists.openvz.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/devel/attachments/20180226/64e84db0/attachment.html>


More information about the Devel mailing list