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


Groups > linux.kernel > #1740352

Re: [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched processing

From Jason Wang <jasowang@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched processing
Date 2017-09-27 04:10 +0200
Message-ID <uu9Xr-4tR-13@gated-at.bofh.it> (permalink)
References <usrc5-3JR-5@gated-at.bofh.it> <usrc6-3JR-25@gated-at.bofh.it> <uu3Im-pY-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 2017年09月27日 03:25, Michael S. Tsirkin wrote:
> On Fri, Sep 22, 2017 at 04:02:35PM +0800, Jason Wang wrote:
>> This patch implements basic batched processing of tx virtqueue by
>> prefetching desc indices and updating used ring in a batch. For
>> non-zerocopy case, vq->heads were used for storing the prefetched
>> indices and updating used ring. It is also a requirement for doing
>> more batching on top. For zerocopy case and for simplicity, batched
>> processing were simply disabled by only fetching and processing one
>> descriptor at a time, this could be optimized in the future.
>>
>> XDP_DROP (without touching skb) on tun (with Moongen in guest) with
>> zercopy disabled:
>>
>> Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz:
>> Before: 3.20Mpps
>> After:  3.90Mpps (+22%)
>>
>> No differences were seen with zerocopy enabled.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
> So where is the speedup coming from? I'd guess the ring is
> hot in cache, it's faster to access it in one go, then
> pass many packets to net stack. Is that right?
>
> Another possibility is better code cache locality.

Yes, I think the speed up comes from:

- less cache misses
- less cache line bounce when virtqueue is about to be full (guest is 
faster than host which is the case of MoonGen)
- less memory barriers
- possible faster copy speed by using copy_to_user() on modern CPUs

>
> So how about this patchset is refactored:
>
> 1. use existing APIs just first get packets then
>     transmit them all then use them all

Looks like current API can not get packets first, it only support get 
packet one by one (if you mean vhost_get_vq_desc()). And used ring 
updating may get more misses in this case.

> 2. add new APIs and move the loop into vhost core
>     for more speedups

I don't see any advantages, looks like just need some e.g callbacks in 
this case.

Thanks

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


Thread

[PATCH net-next RFC 0/5] batched tx processing in vhost_net Jason Wang <jasowang@redhat.com> - 2017-09-22 10:10 +0200
  [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched processing Jason Wang <jasowang@redhat.com> - 2017-09-22 10:10 +0200
    Re: [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched  processing "Michael S. Tsirkin" <mst@redhat.com> - 2017-09-26 21:30 +0200
      Re: [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched  processing Jason Wang <jasowang@redhat.com> - 2017-09-27 04:10 +0200
        Re: [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched  processing "Michael S. Tsirkin" <mst@redhat.com> - 2017-09-28 00:30 +0200
          Re: [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched  processing Jason Wang <jasowang@redhat.com> - 2017-09-28 09:10 +0200
          Re: [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched  processing Jason Wang <jasowang@redhat.com> - 2017-09-28 10:00 +0200
    Re: [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched processing Willem de Bruijn <willemdebruijn.kernel@gmail.com> - 2017-09-28 03:00 +0200
      Re: [PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched  processing Jason Wang <jasowang@redhat.com> - 2017-09-28 10:00 +0200
  [PATCH net-next RFC 1/5] vhost: split out ring head fetching logic Jason Wang <jasowang@redhat.com> - 2017-09-22 10:10 +0200
    Re: [PATCH net-next RFC 1/5] vhost: split out ring head fetching  logic Stefan Hajnoczi <stefanha@gmail.com> - 2017-09-22 10:40 +0200
      Re: [PATCH net-next RFC 1/5] vhost: split out ring head fetching  logic Jason Wang <jasowang@redhat.com> - 2017-09-25 04:10 +0200
  Re: [PATCH net-next RFC 0/5] batched tx processing in vhost_net "Michael S. Tsirkin" <mst@redhat.com> - 2017-09-26 15:50 +0200
    Re: [PATCH net-next RFC 0/5] batched tx processing in vhost_net Jason Wang <jasowang@redhat.com> - 2017-09-27 02:30 +0200
      Re: [PATCH net-next RFC 0/5] batched tx processing in vhost_net "Michael S. Tsirkin" <mst@redhat.com> - 2017-09-28 00:30 +0200
        Re: [PATCH net-next RFC 0/5] batched tx processing in vhost_net Jason Wang <jasowang@redhat.com> - 2017-09-28 09:20 +0200
  Re: [PATCH net-next RFC 0/5] batched tx processing in vhost_net "Michael S. Tsirkin" <mst@redhat.com> - 2017-09-26 21:30 +0200
    Re: [PATCH net-next RFC 0/5] batched tx processing in vhost_net Jason Wang <jasowang@redhat.com> - 2017-09-27 04:10 +0200

csiph-web