From: Ming Lei <ming.lei@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Subject: Re: [PATCH 2/2] blk-mq: Improve performance of non-mq IO schedulers with multiple HW queues
Date: Thu, 7 Jan 2021 14:19:18 +0800 [thread overview]
Message-ID: <20210107061918.GA3897511@T590> (raw)
In-Reply-To: <20210106102428.551-3-jack@suse.cz>
On Wed, Jan 06, 2021 at 11:24:28AM +0100, Jan Kara wrote:
> Currently when non-mq aware IO scheduler (BFQ, mq-deadline) is used for
> a queue with multiple HW queues, the performance it rather bad. The
> problem is that these IO schedulers use queue-wide locking and their
> dispatch function does not respect the hctx it is passed in and returns
> any request it finds appropriate. Thus locality of request access is
> broken and dispatch from multiple CPUs just contends on IO scheduler
> locks. For these IO schedulers there's little point in dispatching from
> multiple CPUs. Instead dispatch always only from a single CPU to limit
> contention.
>
> Below is a comparison of dbench runs on XFS filesystem where the storage
> is a raid card with 64 HW queues and to it attached a single rotating
> disk. BFQ is used as IO scheduler:
>
> clients MQ SQ MQ-Patched
> Amean 1 39.12 (0.00%) 43.29 * -10.67%* 36.09 * 7.74%*
> Amean 2 128.58 (0.00%) 101.30 * 21.22%* 96.14 * 25.23%*
> Amean 4 577.42 (0.00%) 494.47 * 14.37%* 508.49 * 11.94%*
> Amean 8 610.95 (0.00%) 363.86 * 40.44%* 362.12 * 40.73%*
> Amean 16 391.78 (0.00%) 261.49 * 33.25%* 282.94 * 27.78%*
> Amean 32 324.64 (0.00%) 267.71 * 17.54%* 233.00 * 28.23%*
> Amean 64 295.04 (0.00%) 253.02 * 14.24%* 242.37 * 17.85%*
> Amean 512 10281.61 (0.00%) 10211.16 * 0.69%* 10447.53 * -1.61%*
>
> Numbers are times so lower is better. MQ is stock 5.10-rc6 kernel. SQ is
> the same kernel with megaraid_sas.host_tagset_enable=0 so that the card
> advertises just a single HW queue. MQ-Patched is a kernel with this
> patch applied.
>
> You can see multiple hardware queues heavily hurt performance in
> combination with BFQ. The patch restores the performance.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> block/blk-mq.c | 62 ++++++++++++++++++++++++++++++++++------
> block/kyber-iosched.c | 1 +
> include/linux/elevator.h | 2 ++
> 3 files changed, 56 insertions(+), 9 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 57f3482b2c26..26e0f6e64a3a 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -63,15 +63,20 @@ static int blk_mq_poll_stats_bkt(const struct request *rq)
> return bucket;
> }
>
> +/* Check if there are requests queued in hctx lists. */
> +static bool blk_mq_hctx_has_queued_rq(struct blk_mq_hw_ctx *hctx)
> +{
> + return !list_empty_careful(&hctx->dispatch) ||
> + sbitmap_any_bit_set(&hctx->ctx_map);
> +}
> +
blk_mq_hctx_mark_pending() is only called in case of none scheduler, so
looks not necessary to check hctx->ctx_map in blk_mq_hctx_has_queued_rq()
which is supposed to be used when real io scheduler is attached to MQ queue.
Thanks,
Ming
next prev parent reply other threads:[~2021-01-07 6:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-06 10:24 [PATCH 0/2 v2] blk-mq: Improve performance of non-mq IO schedulers with multiple HW queues Jan Kara
2021-01-06 10:24 ` [PATCH 1/2] Revert "blk-mq, elevator: Count requests per hctx to improve performance" Jan Kara
2021-01-06 10:24 ` [PATCH 2/2] blk-mq: Improve performance of non-mq IO schedulers with multiple HW queues Jan Kara
2021-01-07 6:19 ` Ming Lei [this message]
2021-01-07 11:18 ` Jan Kara
2021-01-07 12:06 ` Ming Lei
-- strict thread matches above, loose matches on Subject: below --
2021-01-11 16:47 [PATCH 0/2 v3] " Jan Kara
2021-01-11 16:47 ` [PATCH 2/2] " Jan Kara
2021-01-12 2:15 ` Ming Lei
2020-12-18 21:44 [PATCH 0/2 RFC] " Jan Kara
2020-12-18 21:44 ` [PATCH 2/2] " Jan Kara
2020-12-19 3:14 ` Ming Lei
2020-12-22 10:18 ` Jan Kara
2020-12-22 16:55 ` Jan Kara
2020-12-23 3:43 ` Ming Lei
2020-12-23 3:33 ` 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=20210107061918.GA3897511@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=jack@suse.cz \
--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;
as well as URLs for NNTP newsgroup(s).