From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHrJL-0002SZ-6L for qemu-devel@nongnu.org; Tue, 28 Jun 2016 07:36:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHrJG-00061k-VH for qemu-devel@nongnu.org; Tue, 28 Jun 2016 07:36:10 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHrJG-00061f-OD for qemu-devel@nongnu.org; Tue, 28 Jun 2016 07:36:06 -0400 Received: by mail-wm0-x242.google.com with SMTP id a66so5160976wme.2 for ; Tue, 28 Jun 2016 04:36:06 -0700 (PDT) Sender: Paolo Bonzini References: <1467104499-27517-1-git-send-email-pl@kamp.de> <1467104499-27517-8-git-send-email-pl@kamp.de> From: Paolo Bonzini Message-ID: <8ded21b5-dde9-28a4-72b1-f89ba59c4136@redhat.com> Date: Tue, 28 Jun 2016 13:36:03 +0200 MIME-Version: 1.0 In-Reply-To: <1467104499-27517-8-git-send-email-pl@kamp.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 07/15] qapi: use mmap for QmpInputVisitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven , qemu-devel@nongnu.org Cc: kwolf@redhat.com, peter.maydell@linaro.org, mst@redhat.com, dgilbert@redhat.com, mreitz@redhat.com, kraxel@redhat.com On 28/06/2016 11:01, Peter Lieven wrote: > this struct is approx 75kB > > Signed-off-by: Peter Lieven > --- > qapi/qmp-input-visitor.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Can you change the stack to a QSLIST instead? That's where most of the waste comes from. Thanks, Paolo > diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c > index aea90a1..b6f5dfd 100644 > --- a/qapi/qmp-input-visitor.c > +++ b/qapi/qmp-input-visitor.c > @@ -17,6 +17,7 @@ > #include "qapi/qmp-input-visitor.h" > #include "qapi/visitor-impl.h" > #include "qemu/queue.h" > +#include "qemu/mmap-alloc.h" > #include "qemu-common.h" > #include "qapi/qmp/types.h" > #include "qapi/qmp/qerror.h" > @@ -378,14 +379,14 @@ Visitor *qmp_input_get_visitor(QmpInputVisitor *v) > void qmp_input_visitor_cleanup(QmpInputVisitor *v) > { > qobject_decref(v->root); > - g_free(v); > + qemu_anon_ram_munmap(v, sizeof(*v)); > } > > QmpInputVisitor *qmp_input_visitor_new(QObject *obj, bool strict) > { > QmpInputVisitor *v; > > - v = g_malloc0(sizeof(*v)); > + v = qemu_anon_ram_mmap(sizeof(*v)); > > v->visitor.type = VISITOR_INPUT; > v->visitor.start_struct = qmp_input_start_struct; >