From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1zw8-0004eb-6E for qemu-devel@nongnu.org; Tue, 01 Jul 2014 11:25:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1zw0-0007Vz-8O for qemu-devel@nongnu.org; Tue, 01 Jul 2014 11:25:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1zw0-0007Vl-0T for qemu-devel@nongnu.org; Tue, 01 Jul 2014 11:25:28 -0400 From: Stefan Hajnoczi Date: Tue, 1 Jul 2014 17:25:08 +0200 Message-Id: <1404228309-21122-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1404228309-21122-1-git-send-email-stefanha@redhat.com> References: <1404228309-21122-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH v2 3/4] virtio-blk: avoid g_slice_new0() for VirtIOBlockReq and VirtQueueElement List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , ming.lei@canonical.com, Fam Zheng , Stefan Hajnoczi In commit de6c8042ec55da18702fa51f09072fcaa315edc3 ("virtio-blk: Avoid zeroing every request structure") we avoided the 40 KB memset when allocating VirtIOBlockReq. The memset was reintroduced in commit 671ec3f056559f22a2531a91dce3a258b9b5eb8a ("virtio-blk: Convert VirtIOBlockReq.elem to pointer"). It must be fixed again to avoid a performance regression. Cc: Fam Zheng Signed-off-by: Stefan Hajnoczi --- hw/block/virtio-blk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index aec3146..b06a56d 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -31,9 +31,11 @@ static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s) { - VirtIOBlockReq *req = g_slice_new0(VirtIOBlockReq); + VirtIOBlockReq *req = g_slice_new(VirtIOBlockReq); req->dev = s; - req->elem = g_slice_new0(VirtQueueElement); + req->qiov.size = 0; + req->next = NULL; + req->elem = g_slice_new(VirtQueueElement); return req; } -- 1.9.3