[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 02/17] dataplane: use object pool to speed up
From: |
Ming Lei |
Subject: |
Re: [Qemu-devel] [PATCH v1 02/17] dataplane: use object pool to speed up allocation for virtio blk request |
Date: |
Wed, 6 Aug 2014 10:45:29 +0800 |
On Tue, Aug 5, 2014 at 8:30 PM, Eric Blake <address@hidden> wrote:
> On 08/04/2014 09:33 PM, Ming Lei wrote:
>> g_slice_new(VirtIOBlockReq), its free pair and access the instance
>
> Took me a while to read this. Maybe:
>
> Calling g_slice_new(VirtIOBlockReq) and its free pair, and accessing the
> instance, are a bit slow...
One point is that VirtIOBlockReq is very big, so using libc's allocation
is slow since lock has be to held for thread safety, or maybe brk() is
involved in big allocation too.
Another point is that obj pool can keep these frequent accessed
objects in ram easily, and decrease page fault when accessing
these buffer.
>
>> is a bit slow since sizeof(VirtIOBlockReq) takes more than 40KB,
>> so use object pool to speed up its allocation and release.
>>
>> With this patch, ~5%-10% throughput improvement is observed in the VM
>> based on server.
>>
>> Signed-off-by: Ming Lei <address@hidden>
>> ---
>> hw/block/dataplane/virtio-blk.c | 12 ++++++++++++
>> hw/block/virtio-blk.c | 13 +++++++++++--
>> include/hw/virtio/virtio-blk.h | 2 ++
>> 3 files changed, 25 insertions(+), 2 deletions(-)
>
>> @@ -50,6 +52,10 @@ struct VirtIOBlockDataPlane {
>> Error *blocker;
>> void (*saved_complete_request)(struct VirtIOBlockReq *req,
>> unsigned char status);
>> +
>> + VirtIOBlockReq reqs[REQ_POOL_SZ];
>> + void *free_reqs[REQ_POOL_SZ];
>> + ObjPool req_pool;
>
> Why two instances of double spaces?
reqs is the real space for object, and free_reqs is used for
implementing allocation and release of objects.
Thanks,
[Qemu-devel] [PATCH v1 02/17] dataplane: use object pool to speed up allocation for virtio blk request, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 03/17] qemu coroutine: support bypass mode, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 04/17] block: prepare for supporting selective bypass coroutine, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 05/17] garbage collector: introduced for support of bypass coroutine, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 06/17] block: introduce bdrv_co_can_bypass_co, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 07/17] block: support to bypass qemu coroutinue, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 08/17] Revert "raw-posix: drop raw_get_aio_fd() since it is no longer used", Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 09/17] dataplane: enable selective bypassing coroutine, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 10/17] linux-aio: fix submit aio as a batch, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 11/17] linux-aio: handling -EAGAIN for !s->io_q.plugged case, Ming Lei, 2014/08/04