Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1708875 > unrolled thread
| Started by | "Richard W.M. Jones" <rjones@redhat.com> |
|---|---|
| First post | 2017-08-10 18:50 +0200 |
| Last post | 2017-08-10 18:50 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/2] virtio_scsi: Set can_queue based on size of virtqueue. "Richard W.M. Jones" <rjones@redhat.com> - 2017-08-10 18:50 +0200
[PATCH 2/2] virtio: virtio_scsi: Set can_queue to the length of the virtqueue. "Richard W.M. Jones" <rjones@redhat.com> - 2017-08-10 18:50 +0200
| From | "Richard W.M. Jones" <rjones@redhat.com> |
|---|---|
| Date | 2017-08-10 18:50 +0200 |
| Subject | [PATCH 0/2] virtio_scsi: Set can_queue based on size of virtqueue. |
| Message-ID | <ucYOK-8aT-25@gated-at.bofh.it> |
Earlier discussion: https://lkml.org/lkml/2017/8/4/601 "Increased memory usage with scsi-mq" Downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1478201
[toc] | [next] | [standalone]
| From | "Richard W.M. Jones" <rjones@redhat.com> |
|---|---|
| Date | 2017-08-10 18:50 +0200 |
| Subject | [PATCH 2/2] virtio: virtio_scsi: Set can_queue to the length of the virtqueue. |
| Message-ID | <ucYOK-8aT-31@gated-at.bofh.it> |
| In reply to | #1708875 |
Since switching to blk-mq as the default in commit 5c279bd9e406
("scsi: default to scsi-mq"), virtio-scsi LUNs consume about 10x as
much kernel memory.
qemu currently allocates a fixed 128 entry virtqueue. can_queue
currently is set to 1024. But with indirect descriptors, each command
in the queue takes 1 virtqueue entry, so the number of commands which
can be queued is equal to the length of the virtqueue.
Note I intend to send a patch to qemu to allow the virtqueue size to
be configured from the qemu command line.
Thanks Paolo Bonzini, Christoph Hellwig.
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
drivers/scsi/virtio_scsi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 9be211d68b15..d6b4ff634c0d 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -972,6 +972,8 @@ static int virtscsi_probe(struct virtio_device *vdev)
if (err)
goto virtscsi_init_failed;
+ shost->can_queue = virtqueue_get_vring_size(vscsi->req_vqs[0].vq);
+
cmd_per_lun = virtscsi_config_get(vdev, cmd_per_lun) ?: 1;
shost->cmd_per_lun = min_t(u32, cmd_per_lun, shost->can_queue);
shost->max_sectors = virtscsi_config_get(vdev, max_sectors) ?: 0xFFFF;
--
2.13.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web