From: Jens Axboe <axboe@kernel.dk>
To: linux-block@vger.kernel.org
Cc: brking@linux.vnet.ibm.com, bart.vanassche@wdc.com
Subject: [PATCHSET v2 0/6] block: more scalable inflight tracking
Date: Fri, 4 Aug 2017 09:04:16 -0600 [thread overview]
Message-ID: <1501859062-11120-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. Brian also ran a bunch of numbers on
various implementations of this, showing a big win on a real device
on PPC.
You can also download the code here:
git://git.kernel.dk/linux-block mq-inflight.2
Changes since v1:
- Reword commit message for patch #1, to indicate that the race is
related to when a tag is allocated, not freed.
- Remove redundant init of inflight to 0 in intermediate patch. Didn't
matter for the end result, since it went away in the last patch.
- Kill part_in_flight_double(). Add a prep patch that just changes
part_in_flight() to take an array for accounting instead.
- Fix root vs part accounting.
- Since it's related to tag iteration, add a patch to remove the
sbitmap tags iteration return value. It's unused.
--
Jens Axboe
next reply other threads:[~2017-08-04 15:04 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-04 15:04 Jens Axboe [this message]
2017-08-04 15:04 ` [PATCH 1/6] blk-mq-tag: check for NULL rq when iterating tags Jens Axboe
2017-08-04 19:34 ` Bart Van Assche
2017-08-04 19:35 ` Jens Axboe
2017-08-08 22:28 ` Omar Sandoval
2017-08-04 15:04 ` [PATCH 2/6] block: pass in queue to inflight accounting Jens Axboe
2017-08-08 22:30 ` Omar Sandoval
2017-08-04 15:04 ` [PATCH 3/6] block: make part_in_flight() take an array of two ints Jens Axboe
2017-08-04 19:38 ` Bart Van Assche
2017-08-04 19:40 ` Jens Axboe
2017-08-08 22:42 ` Omar Sandoval
2017-08-08 23:45 ` Jens Axboe
2017-08-04 15:04 ` [PATCH 4/6] blk-mq: provide internal in-flight variant Jens Axboe
2017-08-04 19:43 ` Bart Van Assche
2017-08-04 19:45 ` Jens Axboe
2017-08-08 22:46 ` Omar Sandoval
2017-08-04 15:04 ` [PATCH 5/6] blk-mq: enable checking two part inflight counts at the same time Jens Axboe
2017-08-04 19:44 ` Bart Van Assche
2017-08-04 19:56 ` Jens Axboe
2017-08-06 0:17 ` Bart Van Assche
2017-08-08 22:48 ` Omar Sandoval
2017-08-08 23:47 ` Jens Axboe
2017-08-09 7:14 ` Omar Sandoval
2017-08-09 14:13 ` Jens Axboe
2017-08-04 15:04 ` [PATCH 6/6] sbitmap: make sb_for_each_fn() return void Jens Axboe
2017-08-04 19:49 ` Bart Van Assche
2017-08-04 19:50 ` Jens Axboe
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=1501859062-11120-1-git-send-email-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=bart.vanassche@wdc.com \
--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;
as well as URLs for NNTP newsgroup(s).