[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL V4 01/31] net/tap: Allocating Large sized arrays to h
From: |
Jason Wang |
Subject: |
[Qemu-devel] [PULL V4 01/31] net/tap: Allocating Large sized arrays to heap |
Date: |
Thu, 2 Jun 2016 14:47:52 +0800 |
From: Zhou Jie <address@hidden>
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>
Signed-off-by: Jason Wang <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) {
--
2.7.4
- [Qemu-devel] [PULL V4 00/31] Net patches, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 02/31] net: mipsnet: check packet length against buffer, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 01/31] net/tap: Allocating Large sized arrays to heap,
Jason Wang <=
- [Qemu-devel] [PULL V4 03/31] net: vl: Move default_net to vl.c, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 05/31] pci: fix unaligned access in pci_xxx_quad(), Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 04/31] net/net: Add SocketReadState for reuse codes, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 06/31] msix: make msix_clr_pending() visible for clients, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 07/31] pci: Introduce define for PM capability version 1.1, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 08/31] pcie: Add support for PCIe CAP v1, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 10/31] vmxnet3: Use generic function for DSN capability definition, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 09/31] pcie: Introduce function for DSN capability creation, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 11/31] net: Introduce Toeplitz hash calculator, Jason Wang, 2016/06/02
- [Qemu-devel] [PULL V4 12/31] net: Add macros for MAC address tracing, Jason Wang, 2016/06/02