All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V5 0/7] blk-throttle: Split the blkthrotl queue to solve the IO delay issue
@ 2025-05-06  2:09 Zizhi Wo
  2025-05-06  2:09 ` [PATCH V5 1/7] blk-throttle: Rename tg_may_dispatch() to tg_dispatch_time() Zizhi Wo
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: Zizhi Wo @ 2025-05-06  2:09 UTC (permalink / raw)
  To: axboe, linux-block; +Cc: yangerkun, yukuai3, wozizhi, ming.lei, tj

Changes since V4:
Patch 6 was modified to resolve the conflict.

Changes since V1-3:
1) Updated the comments in patches 4 and 6 for greater specificity.
2) In patch 6, replaced the @queued parameter with @sq in both
throtl_qnode_add_bio and throtl_pop_queued to facilitate internal changes.
And the potential problem of null pointer dereference has been fixed.

[BUG]
The current blkthrotl code provides two types of throttling: BPS limit and
IOPS limit. When both limits are enabled, an IO is only dispatched if it
meets both the BPS and IOPS restrictions. However, when both BPS and IOPS
are limited simultaneously, an IO delayed dispatch issue can occur due to
IO splitting. For example, if two 1MB IOs are issued with a BPS limit of
1MB/s and a very high IOPS limit, the IO splitting will cause both IOs to
complete almost "simultaneously" in 2 seconds.

[CAUSE]
The root cause of this issue is that blkthrotl mixes BPS and IOPS into a
single queue. When issuing multiple IOs sequentially, the continuously
split IOs will repeatedly enter the same queue. As they alternately go
through the throtl process, IOs that have already been throttled will have
to wait for IOs that have not yet been throttled. As a result, all IOs will
eventually complete almost together.

[FIX]
Since IO requests that have already been split no longer need to go through
BPS throttling but still require IOPS control, this patchset splits the
existing blkthrotl queue into two separate queues: BPS and IOPS.
1) IO requests must first pass through the BPS queue.
2) Once they meet the BPS limit, they proceed to the IOPS queue before
being dispatched.
3) Already split IO requests bypass the BPS queue and go directly to the
IOPS queue.

[OVERVIEW]
This patchset consists of 7 patches:
1) Patch 1 is a simple clean_up.
2) Patch 2-4, to facilitate the subsequent splitting of queues. Patch 2-3
separate the -dispatch- and -charge- functions based on the BPS and IOPS.
Patch 4 introduce a new flag to prevent double counting.
3) Patch 5-6 splits the original single queue into two separate queues(BPS
and IOPS) without altering the existing code logic.
4) Patch 7 ensures that split IO requests bypass the BPS queue, preventing
unnecessary throttling and eliminating the delay issue.

Noted, a regression test is posted earlier:
https://lore.kernel.org/all/20250307080318.3860858-3-yukuai1@huaweicloud.com/

Zizhi Wo (7):
  blk-throttle: Rename tg_may_dispatch() to tg_dispatch_time()
  blk-throttle: Refactor tg_dispatch_time by extracting
    tg_dispatch_bps/iops_time
  blk-throttle: Split throtl_charge_bio() into bps and iops functions
  blk-throttle: Introduce flag "BIO_TG_BPS_THROTTLED"
  blk-throttle: Split the blkthrotl queue
  blk-throttle: Split the service queue
  blk-throttle: Prevents the bps restricted io from entering the bps
    queue again

 block/blk-throttle.c      | 300 ++++++++++++++++++++++++--------------
 block/blk-throttle.h      |  17 ++-
 include/linux/blk_types.h |   8 +
 3 files changed, 213 insertions(+), 112 deletions(-)

-- 
2.46.1


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

end of thread, other threads:[~2025-05-15 13:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06  2:09 [PATCH V5 0/7] blk-throttle: Split the blkthrotl queue to solve the IO delay issue Zizhi Wo
2025-05-06  2:09 ` [PATCH V5 1/7] blk-throttle: Rename tg_may_dispatch() to tg_dispatch_time() Zizhi Wo
2025-05-06  2:09 ` [PATCH V5 2/7] blk-throttle: Refactor tg_dispatch_time by extracting tg_dispatch_bps/iops_time Zizhi Wo
2025-05-06  2:09 ` [PATCH V5 3/7] blk-throttle: Split throtl_charge_bio() into bps and iops functions Zizhi Wo
2025-05-06  2:09 ` [PATCH V5 4/7] blk-throttle: Introduce flag "BIO_TG_BPS_THROTTLED" Zizhi Wo
2025-05-06  2:09 ` [PATCH V5 5/7] blk-throttle: Split the blkthrotl queue Zizhi Wo
2025-05-06  2:09 ` [PATCH V5 6/7] blk-throttle: Split the service queue Zizhi Wo
2025-05-15 13:08   ` Aishwarya
2025-05-15 13:39     ` Jens Axboe
2025-05-15 13:47       ` Zizhi Wo
2025-05-15 13:49         ` Jens Axboe
2025-05-06  2:09 ` [PATCH V5 7/7] blk-throttle: Prevents the bps restricted io from entering the bps queue again Zizhi Wo
2025-05-12  1:20 ` [PATCH V5 0/7] blk-throttle: Split the blkthrotl queue to solve the IO delay issue Zizhi Wo
2025-05-13 20:47 ` Jens Axboe

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.