[PATCH v5] virtio: optimize stats counters performance
Morten Brørup
mb at smartsharesystems.com
Thu Aug 1 22:38:07 CEST 2024
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Thursday, 1 August 2024 18.18
>
> On Thu, 1 Aug 2024 16:03:12 +0000
> Morten Brørup <mb at smartsharesystems.com> wrote:
>
> > Optimized the performance of updating the virtio statistics counters
> by
> > reducing the number of branches.
> >
> > Ordered the packet size comparisons according to the probability with
> > typical internet traffic mix.
> >
> > Signed-off-by: Morten Brørup <mb at smartsharesystems.com>
>
> LGTM
> Acked-by: Stephen Hemminger <stephen at networkplumber.org>
>
> I wonder if other software drivers could use similar counters?
While working on this, I noticed the netvsc driver and vhost lib also have size_bins [1], so they are likely candidates.
The netvsc's hn_update_packet_stats() function [2] seems like 100 % copy-paste, and should be easy to paste over with the new implementation.
The vhost lib's vhost_queue_stats_update() function [3] also looks rather similar to the original variant, and could benefit too.
[1]: https://elixir.bootlin.com/dpdk/v24.07/A/ident/size_bins
[2]: https://elixir.bootlin.com/dpdk/v24.07/source/drivers/net/netvsc/hn_rxtx.c#L108
[3]: https://elixir.bootlin.com/dpdk/v24.07/source/lib/vhost/virtio_net.c#L56
I'll take a look around and add similar patches for what I find. Thanks for the reminder.
More information about the dev
mailing list