From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] aio: Use g_slice_alloc() for AIOCB pooling
Date: Wed, 31 Oct 2012 14:30:04 +0100 [thread overview]
Message-ID: <509127DC.5000707@redhat.com> (raw)
In-Reply-To: <1351688609-18984-1-git-send-email-stefanha@redhat.com>
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 <stefanha@redhat.com>
Good idea, should of course be split in multiple patches. :)
Paolo
prev parent reply other threads:[~2012-10-31 13:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-31 13:03 [Qemu-devel] [PATCH] aio: Use g_slice_alloc() for AIOCB pooling Stefan Hajnoczi
2012-10-31 13:30 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=509127DC.5000707@redhat.com \
--to=pbonzini@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).