Re: [PATCH 1/2] virtio-fs: limit number of request queues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peter-Jan,

Thanks for the amazing work! Glad to see it is upstreamed.  We are also
planning distribute virtiofs on DPU.

BTW I have some questions when reading the patch, appreciate if you
could give a hint.


On 5/1/24 11:38 PM, Peter-Jan Gootzen wrote:
> 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.

I'm okay with truncating the num_request_queues to nr_cpu_ids if the
number of the available queues exceeds nr_cpu_ids, as generally 1:1
mapping between cpus and queues is enough and we can not make use more
queues in this case.

I just don't understand the above commit message as how this relates to
the resource footprint at the device side.  When the the number of the
queues actually used by the driver (e.g. nr_cpu_ids is 6) is less than
the amount (e.g. 8) that is advertised by the driver, will the device
side reclaim the resources allocated for the remaining unused queues?
The driver has no way notifying how many queues it actually utilizes.


> 
> 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@xxxxxxxxxx>
> Signed-off-by: Yoray Zack <yorayz@xxxxxxxxxx>
> Suggested-by: Max Gurtovoy <mgurtovoy@xxxxxxxxxx>
> Reviewed-by: Max Gurtovoy <mgurtovoy@xxxxxxxxxx>
> ---
>  fs/fuse/virtio_fs.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
> index 322af827a232..2745fa484dcb 100644
> --- a/fs/fuse/virtio_fs.c
> +++ b/fs/fuse/virtio_fs.c
> @@ -751,6 +751,9 @@ static int virtio_fs_setup_vqs(struct virtio_device *vdev,
>  	if (fs->num_request_queues == 0)
>  		return -EINVAL;
>  
> +	/* Truncate nr of request queues to nr_cpu_id */
> +	fs->num_request_queues = min_t(unsigned int, fs->num_request_queues,
> +					nr_cpu_ids);
>  	fs->nvqs = VQ_REQUEST + fs->num_request_queues;
>  	fs->vqs = kcalloc(fs->nvqs, sizeof(fs->vqs[VQ_HIPRIO]), GFP_KERNEL);
>  	if (!fs->vqs)

-- 
Thanks,
Jingbo




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux