Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1416119

Re: [PATCH V3 2/2] vhost_net: conditionally enable tx polling

From "Michael S. Tsirkin" <mst@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH V3 2/2] vhost_net: conditionally enable tx polling
Date 2016-06-07 14:30 +0200
Message-ID <rHoiR-2DC-5@gated-at.bofh.it> (permalink)
References <rF7m9-4rg-11@gated-at.bofh.it> <rF7m9-4rg-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jun 01, 2016 at 01:56:34AM -0400, Jason Wang wrote:
> We always poll tx for socket, this is sub optimal since:
> 
> - it will be only used when we exceed the sndbuf of the socket.
> - since we use two independent polls for tx and vq, this will slightly
>   increase the waitqueue traversing time and more important, vhost
>   could not benefit from commit
>   9e641bdcfa4ef4d6e2fbaa59c1be0ad5d1551fd5 ("net-tun: restructure
>   tun_do_read for better sleep/wakeup efficiency") even if we've
>   stopped rx polling during handle_rx since tx poll were still left in
>   the waitqueue.
> 
> Fix this by conditionally enable tx polling only when -EAGAIN were
> met.
> 
> Test shows about 8% improvement on guest rx pps.
> 
> Before: ~1350000
> After:  ~1460000
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  drivers/vhost/net.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 1d3e45f..e75ffcc 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -378,6 +378,7 @@ static void handle_tx(struct vhost_net *net)
>  		goto out;
>  
>  	vhost_disable_notify(&net->dev, vq);
> +	vhost_net_disable_vq(net, vq);
>  
>  	hdr_size = nvq->vhost_hlen;
>  	zcopy = nvq->ubufs;
> @@ -459,6 +460,8 @@ static void handle_tx(struct vhost_net *net)
>  					% UIO_MAXIOV;
>  			}
>  			vhost_discard_vq_desc(vq, 1);
> +			if (err == -EAGAIN)
> +				vhost_net_enable_vq(net, vq);
>  			break;
>  		}
>  		if (err != len)

This seems rather risky. What if TX failed for some other reason?
Polling won't ever be re-enabled ...


> -- 
> 1.8.3.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V3 0/2] vhost_net polling optimization Jason Wang <jasowang@redhat.com> - 2016-06-01 08:00 +0200
  [PATCH V3 2/2] vhost_net: conditionally enable tx polling Jason Wang <jasowang@redhat.com> - 2016-06-01 08:00 +0200
    Re: [PATCH V3 2/2] vhost_net: conditionally enable tx polling "Michael S. Tsirkin" <mst@redhat.com> - 2016-06-07 14:30 +0200
      Re: [PATCH V3 2/2] vhost_net: conditionally enable tx polling Jason Wang <jasowang@redhat.com> - 2016-06-08 08:50 +0200
  [PATCH V3 1/2] vhost_net: stop polling socket during rx processing Jason Wang <jasowang@redhat.com> - 2016-06-01 08:00 +0200
    Re: [PATCH V3 1/2] vhost_net: stop polling socket during rx  processing "Michael S. Tsirkin" <mst@redhat.com> - 2016-06-07 14:30 +0200
    Re: [PATCH V3 1/2] vhost_net: stop polling socket during rx  processing David Miller <davem@davemloft.net> - 2016-06-07 23:50 +0200
  Re: [PATCH V3 0/2] vhost_net polling optimization David Miller <davem@davemloft.net> - 2016-06-02 21:10 +0200
    Re: [PATCH V3 0/2] vhost_net polling optimization "Michael S. Tsirkin" <mst@redhat.com> - 2016-06-03 15:10 +0200

csiph-web