|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] libxl: stop libxl_domain_info() consuming massive amounts of stack
commit 2c4b1a7efb15292c0360f305b64581ac135ab8f2
Author: Paul Durrant <pdurrant@xxxxxxxxxx>
AuthorDate: Thu May 28 16:13:30 2020 +0100
Commit: Wei Liu <wl@xxxxxxx>
CommitDate: Tue Jun 2 11:57:01 2020 +0000
libxl: stop libxl_domain_info() consuming massive amounts of stack
Currently an array of 1024 xc_domaininfo_t is declared on stack. That alone
consumes ~112k. Since libxl_domain_info() creates a new gc this patch simply
uses it to allocate the array instead.
Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
Reviewed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
tools/libxl/libxl_domain.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index c08af308fa..39f08a6519 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -314,11 +314,13 @@ libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int
*nb_domain_out)
{
libxl_dominfo *ptr = NULL;
int i, ret;
- xc_domaininfo_t info[1024];
+ xc_domaininfo_t *info;
int size = 0;
uint32_t domid = 0;
GC_INIT(ctx);
+ GCNEW_ARRAY(info, 1024);
+
while ((ret = xc_domain_getinfolist(ctx->xch, domid, 1024, info)) > 0) {
ptr = libxl__realloc(NOGC, ptr, (size + ret) * sizeof(libxl_dominfo));
for (i = 0; i < ret; i++) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |