public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: brookxu <brookxu.cn@gmail.com>
To: tj@kernel.org, axboe@kernel.dk
Cc: ming.lei@redhat.com, cgroups@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] blk-throtl: avoid double charge of bio IOPS due to split
Date: Mon, 10 Jan 2022 16:29:23 +0800	[thread overview]
Message-ID: <1641803363-27550-1-git-send-email-brookxu.cn@gmail.com> (raw)

From: Chunguang Xu <brookxu@tencent.com>

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@tencent.com>
---
 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


             reply	other threads:[~2022-01-10  8:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10  8:29 brookxu [this message]
2022-01-10 10:51 ` [PATCH] blk-throtl: avoid double charge of bio IOPS due to split Ming Lei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1641803363-27550-1-git-send-email-brookxu.cn@gmail.com \
    --to=brookxu.cn@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox