diff options
author | Peter Xu <peterx@redhat.com> | 2019-03-06 19:55:32 +0800 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2019-03-08 10:20:57 +0000 |
commit | 6ca206204fa773c8626d59caf2a5676d6cc35f52 (patch) | |
tree | 3ca63c02029210cbc780cb6f93d0409afb5bac14 /iothread.c | |
parent | b60ec76a13b0d2cd06b4a681f025c180f4dd79a1 (diff) |
iothread: document about why we need explicit aio_poll()
After consulting Paolo I know why we'd better keep the explicit
aio_poll() in iothread_run(). Document it directly into the code so
that future readers will know the answer from day one.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20190306115532.23025-6-peterx@redhat.com
Message-Id: <20190306115532.23025-6-peterx@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'iothread.c')
-rw-r--r-- | iothread.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/iothread.c b/iothread.c index ad64c757ac..7130be58e3 100644 --- a/iothread.c +++ b/iothread.c @@ -63,6 +63,15 @@ static void *iothread_run(void *opaque) qemu_sem_post(&iothread->init_done_sem); while (iothread->running) { + /* + * Note: from functional-wise the g_main_loop_run() below can + * already cover the aio_poll() events, but we can't run the + * main loop unconditionally because explicit aio_poll() here + * is faster than g_main_loop_run() when we do not need the + * gcontext at all (e.g., pure block layer iothreads). In + * other words, when we want to run the gcontext with the + * iothread we need to pay some performance for functionality. + */ aio_poll(iothread->ctx, true); /* |