qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/3] aio: use g_slice_alloc() for AIOCB pooling
@ 2012-10-31 15:34 Stefan Hajnoczi
  2012-10-31 15:34 ` [Qemu-devel] [PATCH v2 1/3] aio: switch aiocb_size type int -> size_t Stefan Hajnoczi
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-10-31 15:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Paolo Bonzini, Anthony Liguori, Stefan Hajnoczi

AIO control blocks are frequently acquired and released because each aio
request involves at least one AIOCB.  Therefore, we 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.

v2:
 * Split into 3 patches (I still took the liberty of combining the AIOPool ->
   AIOCBInfo rename with constification because I didn't want to touch all
   those files twice) [Paolo]

Stefan Hajnoczi (3):
  aio: switch aiocb_size type int -> size_t
  aio: use g_slice_alloc() for AIOCB pooling
  aio: rename AIOPool to AIOCBInfo

 block.c           | 31 ++++++++++++-------------------
 block/blkdebug.c  |  4 ++--
 block/blkverify.c |  4 ++--
 block/curl.c      |  4 ++--
 block/gluster.c   |  6 +++---
 block/iscsi.c     | 12 ++++++------
 block/linux-aio.c |  4 ++--
 block/qed.c       |  4 ++--
 block/rbd.c       |  4 ++--
 block/sheepdog.c  |  4 ++--
 block/win32-aio.c |  4 ++--
 dma-helpers.c     |  4 ++--
 hw/ide/core.c     |  4 ++--
 qemu-aio.h        | 12 +++++-------
 thread-pool.c     |  4 ++--
 15 files changed, 48 insertions(+), 57 deletions(-)

-- 
1.7.11.7

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-11-12 10:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-31 15:34 [Qemu-devel] [PATCH v2 0/3] aio: use g_slice_alloc() for AIOCB pooling Stefan Hajnoczi
2012-10-31 15:34 ` [Qemu-devel] [PATCH v2 1/3] aio: switch aiocb_size type int -> size_t Stefan Hajnoczi
2012-11-02 14:49   ` Paolo Bonzini
2012-10-31 15:34 ` [Qemu-devel] [PATCH v2 2/3] aio: use g_slice_alloc() for AIOCB pooling Stefan Hajnoczi
2012-11-02 14:49   ` Paolo Bonzini
2012-11-12 10:34   ` Kevin Wolf
2012-11-12 10:37     ` Paolo Bonzini
2012-11-12 10:42       ` Kevin Wolf
2012-10-31 15:34 ` [Qemu-devel] [PATCH v2 3/3] aio: rename AIOPool to AIOCBInfo Stefan Hajnoczi
2012-11-02 14:50   ` Paolo Bonzini
2012-11-12 10:34 ` [Qemu-devel] [PATCH v2 0/3] aio: use g_slice_alloc() for AIOCB pooling Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).