Skip to content

Commit bca939d

Browse files
mikechristiemstsirkin
authored andcommitted
vhost-scsi: Dynamically allocate scatterlists
We currently preallocate scatterlists which have 2048 entries for each command. For a small device with just 1 queue this results in: 8 MB = 32 bytes per sg * 2048 entries * 128 cmd When mq is turned on and we increase the virtqueue_size so we can handle commands from multiple queues in parallel, then this can sky rocket. This patch allows us to dynamically allocate the scatterlist like is done with drivers like NVMe and SCSI. For small IO (4-16K) IOPs testing, we didn't see any regressions, but for throughput testing we sometimes saw a 2-5% regression when the backend device was very fast (8 NVMe drives in a MD RAID0 config or a memory backed device). As a result this patch makes the dynamic allocation feature a modparam so userspace can decide how it wants to balance mem use and perf. Signed-off-by: Mike Christie <michael.christie@oracle.com> Message-Id: <20241203191705.19431-6-michael.christie@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
1 parent 891b99e commit bca939d

File tree

2 files changed

+173
-88
lines changed

2 files changed

+173
-88
lines changed

drivers/vhost/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ config VHOST_SCSI
4747
tristate "VHOST_SCSI TCM fabric driver"
4848
depends on TARGET_CORE && EVENTFD
4949
select VHOST
50+
select SG_POOL
5051
default n
5152
help
5253
Say M here to enable the vhost_scsi TCM fabric module

0 commit comments

Comments
 (0)