* [PATCH] blk-throtl: avoid double charge of bio IOPS due to split
@ 2022-01-10 8:29 brookxu
[not found] ` <1641803363-27550-1-git-send-email-brookxu.cn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: brookxu @ 2022-01-10 8:29 UTC (permalink / raw)
To: tj-DgEjT+Ai2ygdnm+yROfE0A, axboe-tSWWG44O7X1aa/9Udqfwiw
Cc: ming.lei-H+wXaHxf7aLQT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-block-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
From: Chunguang Xu <brookxu-1Nz4purKYjRBDgjK7y7TUQ@public.gmane.org>
After commit 900e08075202("block: move queue enter logic into
blk_mq_submit_bio()"), submit_bio_checks() moved to __submit_bio_fops()
and blk_mq_submit_bio(). The IOs go through blk_mq_submit_bio()
may be splited before entering blk-throtl, so we need to check
whether the BIO is throttled, and only update the io_split_cnt
for the THROTTLED bio to avoid double charge.
Signed-off-by: Chunguang Xu <brookxu-1Nz4purKYjRBDgjK7y7TUQ@public.gmane.org>
---
block/blk-throttle.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 39bb6e6..2b12fc7 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -2049,6 +2049,9 @@ void blk_throtl_charge_bio_split(struct bio *bio)
struct throtl_service_queue *parent_sq;
bool rw = bio_data_dir(bio);
+ if (!bio_flagged(bio, BIO_THROTTLED))
+ return;
+
do {
if (!parent->has_rules[rw])
break;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] blk-throtl: avoid double charge of bio IOPS due to split
[not found] ` <1641803363-27550-1-git-send-email-brookxu.cn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-01-10 10:51 ` Ming Lei
0 siblings, 0 replies; 2+ messages in thread
From: Ming Lei @ 2022-01-10 10:51 UTC (permalink / raw)
To: brookxu
Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, axboe-tSWWG44O7X1aa/9Udqfwiw,
cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-block-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Chunguang,
On Mon, Jan 10, 2022 at 04:29:23PM +0800, brookxu wrote:
> From: Chunguang Xu <brookxu-1Nz4purKYjRBDgjK7y7TUQ@public.gmane.org>
>
> After commit 900e08075202("block: move queue enter logic into
> blk_mq_submit_bio()"), submit_bio_checks() moved to __submit_bio_fops()
> and blk_mq_submit_bio(). The IOs go through blk_mq_submit_bio()
> may be splited before entering blk-throtl, so we need to check
> whether the BIO is throttled, and only update the io_split_cnt
> for the THROTTLED bio to avoid double charge.
Today Jens has merged the patch[1] of "block: don't protect
submit_bio_checks by q_usage_counter", so the behavior is switched
back to previous behavior: running bio check before calling
blk_mq_submit_bio() or ->submit_bio().
Then looks your patch isn't needn't any more.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?h=for-5.17/block&id=9d497e2941c30a060ba62d5485b3bc9d91ffb09e
Thanks,
Ming
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-10 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-10 8:29 [PATCH] blk-throtl: avoid double charge of bio IOPS due to split brookxu
[not found] ` <1641803363-27550-1-git-send-email-brookxu.cn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-01-10 10:51 ` Ming Lei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).