From: Stefan Hajnoczi Date: Wed, 9 Jul 2014 08:05:48 +0000 (+0200) Subject: virtio-blk: avoid g_slice_new0() for VirtIOBlockReq and VirtQueueElement X-Git-Tag: qemu-xen-4.6.0-rc1~310^2~9 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=869d66af53d8e04709456c9cae5cca7c560d4b93;p=qemu-upstream-4.6-testing.git virtio-blk: avoid g_slice_new0() for VirtIOBlockReq and VirtQueueElement 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 Signed-off-by: Kevin Wolf --- diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index aec314675..b06a56d94 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; }