[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] aio: Use g_slice_alloc() for AIOCB pooling
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] aio: Use g_slice_alloc() for AIOCB pooling |
Date: |
Wed, 31 Oct 2012 14:30:04 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 |
Il 31/10/2012 14:03, Stefan Hajnoczi ha scritto:
> AIO control blocks are frequently acquired and released because each aio
> request involves at least one AIOCB. Therefore pool them to avoid heap
> allocation overhead.
>
> The problem with the freelist approach in AIOPool is thread-safety. If
> we want BlockDriverStates to associate with AioContexts that execute in
> multiple threads, then a global freelist becomes a problem.
>
> This patch drops the freelist and instead uses g_slice_alloc() which is
> tuned for per-thread fixed-size object pools. qemu_aio_get() and
> qemu_aio_release() are now thread-safe.
>
> Note that the change from g_malloc0() to g_slice_alloc() should be safe
> since the freelist reuse case doesn't zero the AIOCB either.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
Good idea, should of course be split in multiple patches. :)
Paolo