From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHpKk-0006aa-F2 for qemu-devel@nongnu.org; Tue, 28 Jun 2016 05:29:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHpKd-00010q-PB for qemu-devel@nongnu.org; Tue, 28 Jun 2016 05:29:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHpKd-00010h-Jg for qemu-devel@nongnu.org; Tue, 28 Jun 2016 05:29:23 -0400 Date: Tue, 28 Jun 2016 10:29:18 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20160628092918.GD2243@work-vm> References: <1467104499-27517-1-git-send-email-pl@kamp.de> <1467104499-27517-8-git-send-email-pl@kamp.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467104499-27517-8-git-send-email-pl@kamp.de> 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 Cc: qemu-devel@nongnu.org, kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, mst@redhat.com, peter.maydell@linaro.org, kraxel@redhat.com * Peter Lieven (pl@kamp.de) wrote: > this struct is approx 75kB I wonder why it's so large. The stack size in QmpInputVisitor; it's got a 1024 element stack (QIV_STACK_SIZE) and I bet we never use anywhere near that. But even then that's 1024 * a 3 pointer stack object, 24 bytes - I don't see where the rest of that 75kB comes from. I'm a little wary about turning all these malloc's into mmap's because we do seem to use things like input visitors for small things; don't the cost of doing the mmap's add up in time instead of space? Dave > Signed-off-by: Peter Lieven > --- > qapi/qmp-input-visitor.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > 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; > -- > 1.9.1 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK