diff options
author | Max Gurtovoy <mgurtovoy@nvidia.com> | 2021-09-01 16:14:34 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-11-01 04:29:47 -0400 |
commit | 02746e26c39ee473b975e0f68d1295abc92672ed (patch) | |
tree | 96cc7cc855306923dddc0a6238ce4ecdb90c5fe8 /drivers/block/sunvdc.c | |
parent | fc02e8cb0300c0146e1d4668a75663eb225d8182 (diff) | |
download | linux-stable-02746e26c39ee473b975e0f68d1295abc92672ed.tar.gz linux-stable-02746e26c39ee473b975e0f68d1295abc92672ed.tar.bz2 linux-stable-02746e26c39ee473b975e0f68d1295abc92672ed.zip |
virtio-blk: avoid preallocating big SGL for data
No need to pre-allocate a big buffer for the IO SGL anymore. If a device
has lots of deep queues, preallocation for the sg list can consume
substantial amounts of memory. For HW virtio-blk device, nr_hw_queues
can be 64 or 128 and each queue's depth might be 128. This means the
resulting preallocation for the data SGLs is big.
Switch to runtime allocation for SGL for lists longer than 2 entries.
This is the approach used by NVMe drivers so it should be reasonable for
virtio block as well. Runtime SGL allocation has always been the case
for the legacy I/O path so this is nothing new.
The preallocated small SGL depends on SG_CHAIN so if the ARCH doesn't
support SG_CHAIN, use only runtime allocation for the SGL.
Re-organize the setup of the IO request to fit the new sg chain
mechanism.
No performance degradation was seen (fio libaio engine with 16 jobs and
128 iodepth):
IO size IOPs Rand Read (before/after) IOPs Rand Write (before/after)
-------- --------------------------------- ----------------------------------
512B 318K/316K 329K/325K
4KB 323K/321K 353K/349K
16KB 199K/208K 250K/275K
128KB 36K/36.1K 39.2K/41.7K
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Israel Rukshin <israelr@nvidia.com>
Link: https://lore.kernel.org/r/20210901131434.31158-1-mgurtovoy@nvidia.com
Reviewed-by: Feng Li <lifeng1519@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de> # kconfig fixups
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/block/sunvdc.c')
0 files changed, 0 insertions, 0 deletions