All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] block: fix io hung of setting throttle limit frequently
@ 2022-05-16  1:44 ` Zhang Wensheng
  0 siblings, 0 replies; 10+ messages in thread
From: Zhang Wensheng @ 2022-05-16  1:44 UTC (permalink / raw)
  To: tj, axboe; +Cc: linux-block, linux-kernel, cgroups, yukuai3

Our test find a io hung problem which could be simplified:
setting throttle iops/bps limit to small, and to issue a big
bio. if the io is limited to 10s, just wait 1s, continue to
set same throttle iops/bps limit again, now, we could see
that the new throttle time become 10s again, like this, if
we distribute limit repeatedly within 10s, this io will always
in throttle queue.

when the throttle limit iops/bps is set to io. tg_conf_updated
will be called, it will start a new slice and update a new
dispatch time to pending timer which lead to wait again.

Because of commit 9f5ede3c01f9 ("block: throttle split bio in
case of iops limit"), the io will work fine if limited by bps.
which could fix part of the problem, not the root cause.

To fix this problem, adding the judge before update dispatch time.
if the pending timer is alive, we should not to update time.

Signed-off-by: Zhang Wensheng <zhangwensheng5@huawei.com>
---
 block/blk-throttle.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 469c483719be..8acb205dfa85 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1321,12 +1321,14 @@ static void tg_conf_updated(struct throtl_grp *tg, bool global)
 	 * that a group's limit are dropped suddenly and we don't want to
 	 * account recently dispatched IO with new low rate.
 	 */
-	throtl_start_new_slice(tg, READ);
-	throtl_start_new_slice(tg, WRITE);
+	if (!timer_pending(&sq->parent_sq->pending_timer)) {
+		throtl_start_new_slice(tg, READ);
+		throtl_start_new_slice(tg, WRITE);
 
-	if (tg->flags & THROTL_TG_PENDING) {
-		tg_update_disptime(tg);
-		throtl_schedule_next_dispatch(sq->parent_sq, true);
+		if (tg->flags & THROTL_TG_PENDING) {
+			tg_update_disptime(tg);
+			throtl_schedule_next_dispatch(sq->parent_sq, true);
+		}
 	}
 }
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-05-17  7:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  1:44 [PATCH -next] block: fix io hung of setting throttle limit frequently Zhang Wensheng
2022-05-16  1:44 ` Zhang Wensheng
2022-05-16 19:29 ` Tejun Heo
2022-05-16 19:29   ` Tejun Heo
2022-05-17  3:12   ` yukuai (C)
2022-05-17  3:12     ` yukuai (C)
2022-05-17  4:18     ` Tejun Heo
2022-05-17  6:16       ` yukuai (C)
2022-05-17  6:16         ` yukuai (C)
2022-05-17  7:49     ` Ming Lei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.