From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Coly Li <colyli@suse.de>,
linux-bcache@vger.kernel.org
Subject: Re: [PATCH] block: optimize for small BS IO
Date: Tue, 29 Oct 2019 14:28:39 +0800 [thread overview]
Message-ID: <20191029062839.GB20854@ming.t460p> (raw)
In-Reply-To: <20191029041904.16461-1-ming.lei@redhat.com>
On Tue, Oct 29, 2019 at 12:19:04PM +0800, Ming Lei wrote:
> __blk_queue_split() may be a bit heavy for small BS(such as 512B, or
> 4KB) IO, so introduce one flag to decide if this bio includes multiple
> page. And only consider to try splitting this bio in case that
> the multiple page flag is set.
>
> ~3% - 5% IOPS improvement can be observed on io_uring test over
> null_blk(MQ), and the io_uring test code is from fio/t/io_uring.c
>
> bch_bio_map() should be the only one which doesn't use bio_add_page(),
> so force to mark bio built via bch_bio_map() as MULTI_PAGE.
>
> RAID5 has similar usage too, however the bio is really single-page bio,
> so not necessary to handle it.
>
> Cc: Coly Li <colyli@suse.de>
> Cc: linux-bcache@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> block/bio.c | 8 ++++++++
> block/blk-merge.c | 4 ++++
> block/bounce.c | 3 +++
> drivers/md/bcache/util.c | 2 ++
> include/linux/blk_types.h | 1 +
> 5 files changed, 18 insertions(+)
>
> diff --git a/block/bio.c b/block/bio.c
> index 8f0ed6228fc5..c288364b7cf3 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -583,6 +583,8 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
> bio_set_flag(bio, BIO_CLONED);
> if (bio_flagged(bio_src, BIO_THROTTLED))
> bio_set_flag(bio, BIO_THROTTLED);
> + if (bio_flagged(bio_src, BIO_MULTI_PAGE))
> + bio_set_flag(bio, BIO_MULTI_PAGE);
> bio->bi_opf = bio_src->bi_opf;
> bio->bi_ioprio = bio_src->bi_ioprio;
> bio->bi_write_hint = bio_src->bi_write_hint;
> @@ -757,6 +759,9 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page,
> if (page_is_mergeable(bv, page, len, off, same_page)) {
> bv->bv_len += len;
> bio->bi_iter.bi_size += len;
> +
> + if (!*same_page)
> + bio_set_flag(bio, BIO_MULTI_PAGE);
> return true;
> }
> }
> @@ -789,6 +794,9 @@ void __bio_add_page(struct bio *bio, struct page *page,
> bio->bi_iter.bi_size += len;
> bio->bi_vcnt++;
>
> + if (bio->bi_vcnt >= 2 && !bio_flagged(bio, BIO_MULTI_PAGE))
> + bio_set_flag(bio, BIO_MULTI_PAGE);
We have users of adding multiple pages in single bio_add_page(),
will fix it in V2.
Thanks,
Ming
prev parent reply other threads:[~2019-10-29 6:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-29 4:19 [PATCH] block: optimize for small BS IO Ming Lei
2019-10-29 4:30 ` Keith Busch
2019-10-29 6:27 ` Ming Lei
2019-10-29 4:58 ` Coly Li
2019-10-29 6:28 ` Ming Lei [this message]
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=20191029062839.GB20854@ming.t460p \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.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