]> git.proxmox.com Git - mirror_zfs.git/commit
zvol: Support blk-mq for better performance
authorTony Hutter <hutter2@llnl.gov>
Thu, 9 Jun 2022 14:10:38 +0000 (07:10 -0700)
committerGitHub <noreply@github.com>
Thu, 9 Jun 2022 14:10:38 +0000 (08:10 -0600)
commit6f73d02168ea4d4c27e95d3f23df7221c7321e07
tree1fe119d60e4bd41c7fccbfaf0e3d220408ea60ef
parent985c33b132f6c23a69bd808e008ae0f46131a31e
zvol: Support blk-mq for better performance

Add support for the kernel's block multiqueue (blk-mq) interface in
the zvol block driver.  blk-mq creates multiple request queues on
different CPUs rather than having a single request queue.  This can
improve zvol performance with multithreaded reads/writes.

This implementation uses the blk-mq interfaces on 4.13 or newer
kernels.  Building against older kernels will fall back to the
older BIO interfaces.

Note that you must set the `zvol_use_blk_mq` module param to
enable the blk-mq API.  It is disabled by default.

In addition, this commit lets the zvol blk-mq layer process whole
`struct request` IOs at a time, rather than breaking them down
into their individual BIOs.  This reduces dbuf lock contention
and overhead versus the legacy zvol submit_bio() codepath.

sequential dd to one zvol, 8k volblocksize, no O_DIRECT:

legacy submit_bio()     292MB/s write  453MB/s read
this commit             453MB/s write  885MB/s read

It also introduces a new `zvol_blk_mq_chunks_per_thread` module
parameter. This parameter represents how many volblocksize'd chunks
to process per each zvol thread.  It can be used to tune your zvols
for better read vs write performance (higher values favor write,
lower favor read).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ahelenia ZiemiaƄska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #13148
Issue #12483
18 files changed:
config/kernel-blk-queue.m4
include/os/linux/kernel/linux/blkdev_compat.h
include/os/linux/spl/sys/uio.h
man/man4/zfs.4
module/os/linux/zfs/zfs_uio.c
module/os/linux/zfs/zvol_os.c
tests/runfiles/common.run
tests/runfiles/linux.run
tests/zfs-tests/include/commands.cfg
tests/zfs-tests/include/libtest.shlib
tests/zfs-tests/include/tunables.cfg
tests/zfs-tests/tests/Makefile.am
tests/zfs-tests/tests/functional/zvol/zvol_common.shlib
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_fua.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_trim.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/zvol/zvol_stress/cleanup.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/zvol/zvol_stress/setup.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/zvol/zvol_stress/zvol_stress.ksh [new file with mode: 0755]