qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] net/tap: Allocating Large sized arrays to heap


From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH] net/tap: Allocating Large sized arrays to heap
Date: Tue, 26 Apr 2016 15:14:12 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0


On 04/26/2016 09:26 AM, Zhou Jie wrote:
> net_init_tap has a huge stack usage of 8192 bytes approx.
> Moving large arrays to heap to reduce stack usage.
>
> Signed-off-by: Zhou Jie <address@hidden>
> ---
>  net/tap.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/tap.c b/net/tap.c
> index 740e8a2..49817c7 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -769,8 +769,8 @@ int net_init_tap(const NetClientOptions *opts, const char 
> *name,
>              return -1;
>          }
>      } else if (tap->has_fds) {
> -        char *fds[MAX_TAP_QUEUES];
> -        char *vhost_fds[MAX_TAP_QUEUES];
> +        char **fds = g_new(char *, MAX_TAP_QUEUES);
> +        char **vhost_fds = g_new(char *, MAX_TAP_QUEUES);
>          int nfds, nvhosts;
>  
>          if (tap->has_ifname || tap->has_script || tap->has_downscript ||
> @@ -818,6 +818,8 @@ int net_init_tap(const NetClientOptions *opts, const char 
> *name,
>                  return -1;
>              }
>          }
> +        g_free(fds);
> +        g_free(vhost_fds);
>      } else if (tap->has_helper) {
>          if (tap->has_ifname || tap->has_script || tap->has_downscript ||
>              tap->has_vnet_hdr || tap->has_queues || tap->has_vhostfds) {

Apply to net-next.

Thanks



reply via email to

[Prev in Thread] Current Thread [Next in Thread]