Received: from eggs.gnu.org ([2001:4830:134:3::10]:43117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQCXZ-0003cD-OS for qemu-devel@nongnu.org; Mon, 01 Feb 2016 06:21:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQCXW-0001iS-HC for qemu-devel@nongnu.org; Mon, 01 Feb 2016 06:21:05 -0500 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:59434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQCXW-0001iG-7c for qemu-devel@nongnu.org; Mon, 01 Feb 2016 06:21:02 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 1 Feb 2016 11:21:01 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9EB1E1B08067 for ; Mon, 1 Feb 2016 11:21:08 +0000 (GMT) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u11BKw8u60424354 for ; Mon, 1 Feb 2016 11:20:58 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u11BKw9H031253 for ; Mon, 1 Feb 2016 04:20:58 -0700 Date: Mon, 1 Feb 2016 12:20:56 +0100 From: Cornelia Huck Message-ID: <20160201122056.13df4f9e.cornelia.huck@de.ibm.com> In-Reply-To: <1454236146-23293-3-git-send-email-pbonzini@redhat.com> References: <1454236146-23293-1-git-send-email-pbonzini@redhat.com> <1454236146-23293-3-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/10] virtio: move allocation to virtqueue_pop/vring_pop List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, mst@redhat.com On Sun, 31 Jan 2016 11:28:58 +0100 Paolo Bonzini wrote: > The return code of virtqueue_pop/vring_pop is unused except to check for > errors or 0. We can thus easily move allocation inside the functions > and just return a pointer to the VirtQueueElement. > > The advantage is that we will be able to allocate only the space that > is needed for the actual size of the s/g list instead of the full > VIRTQUEUE_MAX_SIZE items. Currently VirtQueueElement takes about 48K > of memory, and this kind of allocation puts a lot of stress on malloc. > By cutting the size by two or three orders of magnitude, malloc can > use much more efficient algorithms. > > The patch is pretty large, but changes to each device are testable > more or less independently. Splitting it would mostly add churn. > > Signed-off-by: Paolo Bonzini > --- > v1->v2: add assertions on sz [Conny] > > hw/9pfs/9p.c | 2 +- > hw/9pfs/virtio-9p-device.c | 17 ++++---- > hw/9pfs/virtio-9p.h | 2 +- > hw/block/dataplane/virtio-blk.c | 11 +++-- > hw/block/virtio-blk.c | 15 +++---- > hw/char/virtio-serial-bus.c | 80 +++++++++++++++++++++++-------------- > hw/display/virtio-gpu.c | 25 +++++++----- > hw/input/virtio-input.c | 24 +++++++---- > hw/net/virtio-net.c | 69 ++++++++++++++++++++------------ > hw/scsi/virtio-scsi-dataplane.c | 15 +++---- > hw/scsi/virtio-scsi.c | 18 ++++----- > hw/virtio/dataplane/vring.c | 18 +++++---- > hw/virtio/virtio-balloon.c | 22 ++++++---- > hw/virtio/virtio-rng.c | 10 +++-- > hw/virtio/virtio.c | 12 ++++-- > include/hw/virtio/dataplane/vring.h | 2 +- > include/hw/virtio/virtio-balloon.h | 2 +- > include/hw/virtio/virtio-blk.h | 3 +- > include/hw/virtio/virtio-net.h | 2 +- > include/hw/virtio/virtio-scsi.h | 2 +- > include/hw/virtio/virtio-serial.h | 2 +- > include/hw/virtio/virtio.h | 2 +- > 22 files changed, 212 insertions(+), 143 deletions(-) Reviewed-by: Cornelia Huck