]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
block: loop: improve performance via blk-mq
authorMing Lei <ming.lei@canonical.com>
Wed, 31 Dec 2014 13:22:57 +0000 (13:22 +0000)
committerJens Axboe <axboe@fb.com>
Fri, 2 Jan 2015 22:07:49 +0000 (15:07 -0700)
commitb5dd2f6047ca108001328aac0e8588edd15f1778
treeb08f0cddb15b83f9f1c898b4e20616ddd5b1de04
parentc761d96b079e99d106fa4064e730ef7d0f312f9d
block: loop: improve performance via blk-mq

The conversion is a bit straightforward, and use work queue to
dispatch requests of loop block, and one big change is that requests
is submitted to backend file/device concurrently with work queue,
so throughput may get improved much. Given write requests over same
file are often run exclusively, so don't handle them concurrently for
avoiding extra context switch cost, possible lock contention and work
schedule cost. Also with blk-mq, there is opportunity to get loop I/O
merged before submitting to backend file/device.

In the following test:
- base: v3.19-rc2-2041231
- loop over file in ext4 file system on SSD disk
- bs: 4k, libaio, io depth: 64, O_DIRECT, num of jobs: 1
- throughput: IOPS

------------------------------------------------------
|            | base      | base with loop-mq | delta |
------------------------------------------------------
| randread   | 1740      | 25318             | +1355%|
------------------------------------------------------
| read       | 42196     | 51771             | +22.6%|
-----------------------------------------------------
| randwrite  | 35709     | 34624             | -3%   |
-----------------------------------------------------
| write      | 39137     | 40326             | +3%   |
-----------------------------------------------------

So loop-mq can improve throughput for both read and randread, meantime,
performance of write and randwrite isn't hurted basically.

Another benefit is that loop driver code gets simplified
much after blk-mq conversion, and the patch can be thought as
cleanup too.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/loop.c
drivers/block/loop.h