From: Jens Axboe <axboe@kernel.dk>
To: linux-block@vger.kernel.org
Cc: brking@linux.vnet.ibm.com
Subject: [PATCH 0/4] block: more scalable inflight tracking
Date: Thu, 3 Aug 2017 14:01:52 -0600 [thread overview]
Message-ID: <1501790516-6924-1-git-send-email-axboe@kernel.dk> (raw)
One scaling issue we currently have in the block code is the
inflight accounting. It's based on a per-device atomic count
for reads and writes, which means that even for an mq device
with lots of hardware queues, we end up dirtying a per-device
cacheline for each IO. The issue can easily be observed by
using null_blk:
modprobe null_blk submit_queues=48 queue_mode=2
and running a fio job that has 32 jobs doing sync reads on
the device (average of 3 runs, though deviation is low):
stats IOPS usr sys
------------------------------------------------------
on 2.6M 5.4% 94.6%
off 21.0M 33.7% 67.3%
which shows a 10x slowdown with stats enabled. If we look at
the profile for stats on, the top entries are:
37.38% fio [kernel.vmlinux] [k] blk_account_io_done
14.65% fio [kernel.vmlinux] [k] blk_account_io_start
14.29% fio [kernel.vmlinux] [k] part_round_stats_single
11.81% fio [kernel.vmlinux] [k] blk_account_io_completion
3.62% fio [kernel.vmlinux] [k] part_round_stats
0.81% fio [kernel.vmlinux] [k] __blkdev_direct_IO_simple
which shows the system time being dominated by the stats accounting.
This patch series replaces the atomic counter with using the tags
hamming weight for tracking infligh counts. This means we don't have
to do anything when IO starts or completes, and for reading the value
we just have to check how many bits we have set in the tag maps on
the queues. This part is limited to 1000 per second (for HZ=1000).
Using this approach, running the same test again results in:
stats IOPS usr sys
------------------------------------------------------
on 20.4M 30.9% 69.0%
off 21.4M 32.4% 67.4%
and doing a profiled run with stats on, the top of stats reporting is
now:
1.23% fio [kernel.vmlinux] [k] blk_account_io_done
0.83% fio [kernel.vmlinux] [k] blk_account_io_start
0.55% fio [kernel.vmlinux] [k] blk_account_io_completion
which is a lot more reasonable. The difference between stats on and
off is now also neglible.
--
Jens Axboe
next reply other threads:[~2017-08-03 20:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 20:01 Jens Axboe [this message]
2017-08-03 20:01 ` [PATCH 1/4] blk-mq-tag: check for NULL rq when iterating tags Jens Axboe
2017-08-03 20:29 ` Bart Van Assche
2017-08-03 20:35 ` Jens Axboe
2017-08-03 20:40 ` Jens Axboe
2017-08-03 20:50 ` Bart Van Assche
2017-08-03 20:56 ` Jens Axboe
2017-08-03 20:01 ` [PATCH 2/4] block: pass in queue to inflight accounting Jens Axboe
2017-08-03 20:35 ` Bart Van Assche
2017-08-03 20:37 ` Jens Axboe
2017-08-03 20:01 ` [PATCH 3/4] blk-mq: provide internal in-flight variant Jens Axboe
2017-08-03 20:41 ` Bart Van Assche
2017-08-03 20:45 ` Jens Axboe
2017-08-03 20:54 ` Bart Van Assche
2017-08-03 21:25 ` Bart Van Assche
2017-08-03 22:36 ` Jens Axboe
2017-08-04 11:17 ` Ming Lei
2017-08-04 13:55 ` Jens Axboe
2017-08-04 22:19 ` Ming Lei
2017-08-07 19:54 ` Brian King
2017-08-03 20:01 ` [PATCH 4/4] blk-mq: enable checking two part inflight counts at the same time Jens Axboe
2017-08-03 21:29 ` Bart Van Assche
2017-08-03 22:38 ` Jens Axboe
2017-08-03 22:30 ` Bart Van Assche
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=1501790516-6924-1-git-send-email-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=brking@linux.vnet.ibm.com \
--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