[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/8] virtio-blk: Avoid zeroing every request structu
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 2/8] virtio-blk: Avoid zeroing every request structure |
Date: |
Thu, 20 May 2010 15:10:37 +0200 |
From: Stefan Hajnoczi <address@hidden>
The VirtIOBlockRequest structure is about 40 KB in size. This patch
avoids zeroing every request by only initializing fields that are read.
The other fields are either written to or may not be used at all.
Oprofile shows about 10% of CPU samples in memset called by
virtio_blk_alloc_request(). The workload is
dd if=/dev/vda of=/dev/null iflag=direct bs=8k running concurrently 4
times. This patch makes memset disappear to the bottom of the profile.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/virtio-blk.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index b05d15e..d270225 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -105,8 +105,10 @@ static void virtio_blk_flush_complete(void *opaque, int
ret)
static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s)
{
- VirtIOBlockReq *req = qemu_mallocz(sizeof(*req));
+ VirtIOBlockReq *req = qemu_malloc(sizeof(*req));
req->dev = s;
+ req->qiov.size = 0;
+ req->next = NULL;
return req;
}
--
1.6.6.1
- [Qemu-devel] [PULL 0/8] Block patches, Kevin Wolf, 2010/05/20
- [Qemu-devel] [PATCH 2/8] virtio-blk: Avoid zeroing every request structure,
Kevin Wolf <=
- [Qemu-devel] [PATCH 4/8] block: fix sector comparism in multiwrite_req_compare, Kevin Wolf, 2010/05/20
- [Qemu-devel] [PATCH 3/8] virtio-blk: fix barrier support, Kevin Wolf, 2010/05/20
- [Qemu-devel] [PATCH 1/8] block: fix aio_flush segfaults for read-only protocols (e.g. curl), Kevin Wolf, 2010/05/20
- [Qemu-devel] [PATCH 5/8] block: Make find_image_format() return 'raw' BlockDriver for SG_IO devices, Kevin Wolf, 2010/05/20
- [Qemu-devel] [PATCH 6/8] block: Add SG_IO device check in refresh_total_sectors(), Kevin Wolf, 2010/05/20
- [Qemu-devel] [PATCH 8/8] vvfat: More build fixes with DEBUG, Kevin Wolf, 2010/05/20
- [Qemu-devel] [PATCH 7/8] vvfat: Fix compilation with DEBUG defined, Kevin Wolf, 2010/05/20