[PATCH v3 5/5] vhost_user: Increase number of memory regions

fengchengwen fengchengwen at huawei.com
Tue Nov 4 09:12:19 CET 2025


On 11/4/2025 12:21 PM, Pravin M Bathija wrote:
> In this patch the number of memory regions are increased from
> 8 to 128. When a vhost-user front-end such as qemu or libblkio
> queries the back-end such as dpdk with the message, get max number
> of memory slots, the back-end replies with this number 128 instead
> of the previously defined 8. The back-end also allocates that many
> slots in the memory table where regions are added/removed as
> requested by the vhost-user front-end. This also helps the vhost-
> user front-end to limit the number of memory regions when sending
> the set mem table message ar adding memory regions.
> 
> Signed-off-by: Pravin M Bathija <pravin.bathija at dell.com>
> ---
>  lib/vhost/vhost_user.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vhost/vhost_user.h b/lib/vhost/vhost_user.h
> index 5a0e747b58..c6ad5b76d6 100644
> --- a/lib/vhost/vhost_user.h
> +++ b/lib/vhost/vhost_user.h
> @@ -11,7 +11,7 @@
>  
>  /* refer to hw/virtio/vhost-user.c */
>  
> -#define VHOST_MEMORY_MAX_NREGIONS 8
> +#define VHOST_MEMORY_MAX_NREGIONS 128

The address translation may increase a lot if the real region is 128.
Maybe we should add another patch to optimize it.

>  
>  #define VHOST_USER_NET_SUPPORTED_FEATURES \
>  	(VIRTIO_NET_SUPPORTED_FEATURES | \



More information about the dev mailing list