From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIchY-0005LX-BG for qemu-devel@nongnu.org; Thu, 30 Jun 2016 10:12:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIchT-0002q4-7d for qemu-devel@nongnu.org; Thu, 30 Jun 2016 10:12:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIchT-0002px-23 for qemu-devel@nongnu.org; Thu, 30 Jun 2016 10:12:15 -0400 From: Markus Armbruster References: <1467104499-27517-1-git-send-email-pl@kamp.de> <1467104499-27517-8-git-send-email-pl@kamp.de> Date: Thu, 30 Jun 2016 16:12:12 +0200 In-Reply-To: <1467104499-27517-8-git-send-email-pl@kamp.de> (Peter Lieven's message of "Tue, 28 Jun 2016 11:01:31 +0200") Message-ID: <87bn2i6a0z.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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, peter.maydell@linaro.org, mst@redhat.com, dgilbert@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com Peter Lieven writes: > this struct is approx 75kB 32KiB on x86_64, almost entirely eaten by member stack. As Dan observed, we use many short-lived QmpInputVisitors. However, we should not be using many simultaneously. That would be necessary for 32KiB objects to have an impact on memory use. Are you sure these have an impact? Implementing a stack as "big enough" array can be wasteful. Implementing it as dynamically allocated list is differently wasteful. Saving several mallocs and frees can be worth "wasting" a few pages of memory for a short time.