From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Li Ning <lining2020x@163.com>,
Tejun Heo <tj@kernel.org>, Chunguang Xu <brookxu@tencent.com>,
Ming Lei <ming.lei@redhat.com>
Subject: [PATCH V2 4/7] block: don't check bio in blk_throtl_dispatch_work_fn
Date: Wed, 9 Feb 2022 17:14:26 +0800 [thread overview]
Message-ID: <20220209091429.1929728-5-ming.lei@redhat.com> (raw)
In-Reply-To: <20220209091429.1929728-1-ming.lei@redhat.com>
The bio has been checked already before throttling, so no need to check
it again before dispatching it from throttle queue.
Add one local helper of submit_bio_noacct_nocheck() for this purpose.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
block/blk-core.c | 35 ++++++++++++++++++++++-------------
block/blk-throttle.c | 2 +-
block/blk.h | 1 +
3 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 1514dbab0bd8..4de9f391836b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -876,20 +876,8 @@ static void __submit_bio_noacct_mq(struct bio *bio)
current->bio_list = NULL;
}
-/**
- * submit_bio_noacct - re-submit a bio to the block device layer for I/O
- * @bio: The bio describing the location in memory and on the device.
- *
- * This is a version of submit_bio() that shall only be used for I/O that is
- * resubmitted to lower level drivers by stacking block drivers. All file
- * systems and other upper level users of the block layer should use
- * submit_bio() instead.
- */
-void submit_bio_noacct(struct bio *bio)
+static inline void __submit_bio_noacct_nocheck(struct bio *bio)
{
- if (unlikely(!submit_bio_checks(bio)))
- return;
-
/*
* We only want one ->submit_bio to be active at a time, else stack
* usage with stacked devices could be a problem. Use current->bio_list
@@ -903,8 +891,29 @@ void submit_bio_noacct(struct bio *bio)
else
__submit_bio_noacct(bio);
}
+
+/**
+ * submit_bio_noacct - re-submit a bio to the block device layer for I/O
+ * @bio: The bio describing the location in memory and on the device.
+ *
+ * This is a version of submit_bio() that shall only be used for I/O that is
+ * resubmitted to lower level drivers by stacking block drivers. All file
+ * systems and other upper level users of the block layer should use
+ * submit_bio() instead.
+ */
+void submit_bio_noacct(struct bio *bio)
+{
+ if (unlikely(!submit_bio_checks(bio)))
+ return;
+ __submit_bio_noacct_nocheck(bio);
+}
EXPORT_SYMBOL(submit_bio_noacct);
+void submit_bio_noacct_nocheck(struct bio *bio)
+{
+ __submit_bio_noacct_nocheck(bio);
+}
+
/**
* submit_bio - submit a bio to the block device layer for I/O
* @bio: The &struct bio which describes the I/O
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 7c462c006b26..6cca1715c31e 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1219,7 +1219,7 @@ static void blk_throtl_dispatch_work_fn(struct work_struct *work)
if (!bio_list_empty(&bio_list_on_stack)) {
blk_start_plug(&plug);
while ((bio = bio_list_pop(&bio_list_on_stack)))
- submit_bio_noacct(bio);
+ submit_bio_noacct_nocheck(bio);
blk_finish_plug(&plug);
}
}
diff --git a/block/blk.h b/block/blk.h
index b2516cb4f98e..ebaa59ca46ca 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -46,6 +46,7 @@ void blk_freeze_queue(struct request_queue *q);
void __blk_mq_unfreeze_queue(struct request_queue *q, bool force_atomic);
void blk_queue_start_drain(struct request_queue *q);
int __bio_queue_enter(struct request_queue *q, struct bio *bio);
+void submit_bio_noacct_nocheck(struct bio *bio);
static inline bool blk_try_enter_queue(struct request_queue *q, bool pm)
{
--
2.31.1
next prev parent reply other threads:[~2022-02-09 9:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 9:14 [PATCH V2 0/7] block: improve iops limit throttle Ming Lei
2022-02-09 9:14 ` [PATCH V2 1/7] block: move submit_bio_checks() into submit_bio_noacct Ming Lei
2022-02-09 14:01 ` Christoph Hellwig
2022-02-09 9:14 ` [PATCH V2 2/7] block: move blk_crypto_bio_prep() out of blk-mq.c Ming Lei
2022-02-09 14:02 ` Christoph Hellwig
2022-02-09 9:14 ` [PATCH V2 3/7] block: don't declare submit_bio_checks in local header Ming Lei
2022-02-09 14:02 ` Christoph Hellwig
2022-02-09 9:14 ` Ming Lei [this message]
2022-02-09 14:03 ` [PATCH V2 4/7] block: don't check bio in blk_throtl_dispatch_work_fn Christoph Hellwig
2022-02-09 9:14 ` [PATCH V2 5/7] block: throttle split bio in case of iops limit Ming Lei
2022-02-14 20:22 ` Tejun Heo
2022-02-15 1:10 ` Ming Lei
2022-02-15 7:08 ` Christoph Hellwig
2022-02-15 8:02 ` Ming Lei
2022-02-15 8:17 ` Ning Li
2022-02-15 8:20 ` Ning Li
2022-02-09 9:14 ` [PATCH V2 6/7] block: don't try to throttle split bio if iops limit isn't set Ming Lei
2022-02-09 9:14 ` [PATCH V2 7/7] block: revert 4f1e9630afe6 ("blk-throtl: optimize IOPS throttle for large IO scenarios") Ming Lei
2022-02-13 8:34 ` [PATCH V2 0/7] block: improve iops limit throttle 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=20220209091429.1929728-5-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=brookxu@tencent.com \
--cc=lining2020x@163.com \
--cc=linux-block@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).