From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 0/5] threadpool: support multiple ThreadPools
Date: Wed, 6 Mar 2013 16:45:30 +0100 [thread overview]
Message-ID: <1362584735-30911-1-git-send-email-stefanha@redhat.com> (raw)
This patch series changes the global thread pool to a one ThreadPool per
AioContext model. We still only use the main loop AioContext so in practice
there is just one ThreadPool. But this opens the door to refactoring the block
layer (which depends on ThreadPool) so block devices can be accessed outside
the global mutex in the future.
ThreadPool is tightly bound to an AioContext because it uses an EventNotifier
to signal work completion. Completed work items are reaped and their callback
functions are invoked from the EventNotifier read handler (executing under
AioContext).
It might be possible to record the AioContext for the completion callback on a
per-request basis and continuing to use a global pool of worker threads. After
discussing thread pool models with Paolo I have been convinced that it is
simpler and more scalable to have one ThreadPool per AioContext instead.
Therefore this series implements the 1:1 approach. For details on previous
thread pool model discussion, see:
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg03987.html
At the end of this series block/raw-posix.c and block/raw-win32.c are aware of
the ThreadPool they submit work to. The next step after this series is to
associate BlockDriverState with an AioContext so that the block layer can run
outside the global main loop.
Stefan Hajnoczi (5):
threadpool: move globals into struct ThreadPool
threadpool: add thread_pool_new() and thread_pool_free()
aio: add a ThreadPool instance to AioContext
main-loop: add qemu_get_aio_context()
threadpool: drop global thread pool
async.c | 11 ++
block/raw-posix.c | 8 +-
block/raw-win32.c | 4 +-
include/block/aio.h | 6 ++
include/block/thread-pool.h | 15 ++-
include/qemu/main-loop.h | 5 +
main-loop.c | 5 +
tests/test-thread-pool.c | 44 ++++----
thread-pool.c | 252 ++++++++++++++++++++++++++++----------------
trace-events | 4 +-
10 files changed, 233 insertions(+), 121 deletions(-)
--
1.8.1.4
next reply other threads:[~2013-03-06 15:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 15:45 Stefan Hajnoczi [this message]
2013-03-06 15:45 ` [Qemu-devel] [PATCH 1/5] threadpool: move globals into struct ThreadPool Stefan Hajnoczi
2013-03-06 17:25 ` Paolo Bonzini
2013-03-08 3:18 ` Wenchao Xia
2013-03-06 15:45 ` [Qemu-devel] [PATCH 2/5] threadpool: add thread_pool_new() and thread_pool_free() Stefan Hajnoczi
2013-03-06 16:36 ` Paolo Bonzini
2013-03-06 15:45 ` [Qemu-devel] [PATCH 3/5] aio: add a ThreadPool instance to AioContext Stefan Hajnoczi
2013-03-06 17:24 ` Paolo Bonzini
2013-03-07 10:02 ` Stefan Hajnoczi
2013-03-06 15:45 ` [Qemu-devel] [PATCH 4/5] main-loop: add qemu_get_aio_context() Stefan Hajnoczi
2013-03-06 17:26 ` Paolo Bonzini
2013-03-06 15:45 ` [Qemu-devel] [PATCH 5/5] threadpool: drop global thread pool Stefan Hajnoczi
2013-03-06 16:35 ` Paolo Bonzini
2013-03-07 10:07 ` Stefan Hajnoczi
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=1362584735-30911-1-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).