[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 7/7] iothread: document about why we need explicit ai
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-block] [PULL 7/7] iothread: document about why we need explicit aio_poll() |
Date: |
Fri, 8 Mar 2019 16:53:44 +0000 |
From: Peter Xu <address@hidden>
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 <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
iothread.c | 9 +++++++++
1 file changed, 9 insertions(+)
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);
/*
--
2.20.1
- [Qemu-block] [PULL 0/7] Block patches, Stefan Hajnoczi, 2019/03/08
- [Qemu-block] [PULL 1/7] MAINTAINERS: add missing support status fields, Stefan Hajnoczi, 2019/03/08
- [Qemu-block] [PULL 2/7] hw/block/virtio-blk: Clean req->dev repetitions, Stefan Hajnoczi, 2019/03/08
- [Qemu-block] [PULL 3/7] iothread: replace init_done_cond with a semaphore, Stefan Hajnoczi, 2019/03/08
- [Qemu-block] [PULL 4/7] iothread: create the gcontext unconditionally, Stefan Hajnoczi, 2019/03/08
- [Qemu-block] [PULL 5/7] iothread: create main loop unconditionally, Stefan Hajnoczi, 2019/03/08
- [Qemu-block] [PULL 6/7] iothread: push gcontext earlier in the thread_fn, Stefan Hajnoczi, 2019/03/08
- [Qemu-block] [PULL 7/7] iothread: document about why we need explicit aio_poll(),
Stefan Hajnoczi <=
- Re: [Qemu-block] [PULL 0/7] Block patches, Peter Maydell, 2019/03/09