[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 7/8] thread-pool: add missing qemu_bh_cancel in compl
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 7/8] thread-pool: add missing qemu_bh_cancel in completion function |
Date: |
Fri, 17 Mar 2017 14:15:45 +0100 |
From: Peter Lieven <address@hidden>
commit 3c80ca15 fixed a deadlock scenarion with nested aio_poll invocations.
However, the rescheduling of the completion BH introcuded unnecessary spinning
in the main-loop. On very fast file backends this can even lead to the
"WARNING: I/O thread spun for 1000 iterations" message popping up.
Callgrind reports about 3-4% less instructions with this patch running
qemu-img bench on a ramdisk based VMDK file.
Fixes: 3c80ca158c96ff902a30883a8933e755988948b1
Cc: address@hidden
Signed-off-by: Peter Lieven <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
util/thread-pool.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/util/thread-pool.c b/util/thread-pool.c
index ce6cd30..610646d 100644
--- a/util/thread-pool.c
+++ b/util/thread-pool.c
@@ -188,6 +188,13 @@ restart:
aio_context_release(pool->ctx);
elem->common.cb(elem->common.opaque, elem->ret);
aio_context_acquire(pool->ctx);
+
+ /* We can safely cancel the completion_bh here regardless of
someone
+ * else having scheduled it meanwhile because we reenter the
+ * completion function anyway (goto restart).
+ */
+ qemu_bh_cancel(pool->completion_bh);
+
qemu_aio_unref(elem);
goto restart;
} else {
--
1.8.3.1
- [Qemu-block] [PULL 0/8] Block layer fixes for 2.9.0-rc1, Kevin Wolf, 2017/03/17
- [Qemu-block] [PULL 1/8] file-posix: clean up max_segments buffer termination, Kevin Wolf, 2017/03/17
- [Qemu-block] [PULL 2/8] replication: clarify permissions, Kevin Wolf, 2017/03/17
- [Qemu-block] [PULL 5/8] blockdev: fix bitmap clear undo, Kevin Wolf, 2017/03/17
- [Qemu-block] [PULL 6/8] block: Propagate error in bdrv_open_backing_file, Kevin Wolf, 2017/03/17
- [Qemu-block] [PULL 3/8] file-posix: Don't leak fd in hdev_get_max_segments, Kevin Wolf, 2017/03/17
- [Qemu-block] [PULL 7/8] thread-pool: add missing qemu_bh_cancel in completion function,
Kevin Wolf <=
- [Qemu-block] [PULL 4/8] block: Always call bdrv_child_check_perm first, Kevin Wolf, 2017/03/17
- [Qemu-block] [PULL 8/8] block: quiesce AioContext when detaching from it, Kevin Wolf, 2017/03/17
- Re: [Qemu-block] [Qemu-devel] [PULL 0/8] Block layer fixes for 2.9.0-rc1, Peter Maydell, 2017/03/17