Skip to content

Commit 103c2de

Browse files
Peter-JanGootzenMiklos Szeredi
authored andcommitted
virtio-fs: limit number of request queues
Virtio-fs devices might allocate significant resources to virtio queues such as CPU cores that busy poll on the queue. The device indicates how many request queues it can support and the driver should initialize the number of queues that they want to utilize. In this patch we limit the number of initialized request queues to the number of CPUs, to limit the resource consumption on the device-side and to prepare for the upcoming multi-queue patch. Signed-off-by: Peter-Jan Gootzen <pgootzen@nvidia.com> Signed-off-by: Yoray Zack <yorayz@nvidia.com> Suggested-by: Max Gurtovoy <mgurtovoy@nvidia.com> Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 2460148 commit 103c2de

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/fuse/virtio_fs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,9 @@ static int virtio_fs_setup_vqs(struct virtio_device *vdev,
751751
if (fs->num_request_queues == 0)
752752
return -EINVAL;
753753

754+
/* Truncate nr of request queues to nr_cpu_id */
755+
fs->num_request_queues = min_t(unsigned int, fs->num_request_queues,
756+
nr_cpu_ids);
754757
fs->nvqs = VQ_REQUEST + fs->num_request_queues;
755758
fs->vqs = kcalloc(fs->nvqs, sizeof(fs->vqs[VQ_HIPRIO]), GFP_KERNEL);
756759
if (!fs->vqs)

0 commit comments

Comments
 (0)