[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/21] throttle-groups: Skip the round-robin if a mem
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 03/21] throttle-groups: Skip the round-robin if a member is being drained |
Date: |
Wed, 15 Aug 2018 14:55:19 +0200 |
From: Alberto Garcia <address@hidden>
In the throttling code after an I/O request has been completed the
next one is selected from a different member using a round-robin
algorithm. This ensures that all members get a chance to finish their
pending I/O requests.
However, if a group member has its I/O limits disabled (because it's
being drained) then we should always give it priority in order to have
all its pending requests finished as soon as possible.
If we don't do this we could have a member in the process of being
drained waiting for the throttled requests of other members, for which
the I/O limits still apply.
This can have additional consequences: if we're running in qtest mode
(with QEMU_CLOCK_VIRTUAL) then timers can only fire if we advance the
clock manually, so attempting to drain a block device can hang QEMU in
the BDRV_POLL_WHILE() loop at the end of bdrv_do_drained_begin().
Signed-off-by: Alberto Garcia <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/throttle-groups.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/block/throttle-groups.c b/block/throttle-groups.c
index e297b04e17..d46c56b31e 100644
--- a/block/throttle-groups.c
+++ b/block/throttle-groups.c
@@ -221,6 +221,15 @@ static ThrottleGroupMember
*next_throttle_token(ThrottleGroupMember *tgm,
ThrottleGroup *tg = container_of(ts, ThrottleGroup, ts);
ThrottleGroupMember *token, *start;
+ /* If this member has its I/O limits disabled then it means that
+ * it's being drained. Skip the round-robin search and return tgm
+ * immediately if it has pending requests. Otherwise we could be
+ * forcing it to wait for other member's throttled requests. */
+ if (tgm_has_pending_reqs(tgm, is_write) &&
+ atomic_read(&tgm->io_limits_disabled)) {
+ return tgm;
+ }
+
start = token = tg->tokens[is_write];
/* get next bs round in round robin style */
--
2.13.6
- [Qemu-devel] [PULL 00/21] Block layer patches, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 03/21] throttle-groups: Skip the round-robin if a member is being drained,
Kevin Wolf <=
- [Qemu-devel] [PULL 01/21] block/qapi: Fix memory leak in qmp_query_blockstats(), Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 06/21] luks: Allow share-rw=on, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 02/21] qemu-iotests: Test removing a throttle group member with a pending timer, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 04/21] qemu-iotests: Update 093 to improve the draining test, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 05/21] throttle-groups: Don't allow timers without throttled requests, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 07/21] block: Remove deprecated -drive geometry options, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 15/21] block: drop empty .bdrv_close handlers, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 13/21] qemu-img: fix regression copying secrets during convert, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 11/21] qapi/block: Document restrictions for node names, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 09/21] block: Remove deprecated -drive option serial, Kevin Wolf, 2018/08/15