[PATCH v5] virtio: optimize stats counters performance

Maxime Coquelin maxime.coquelin at redhat.com
Tue Sep 10 17:01:16 CEST 2024



On 8/1/24 18:03, Morten Brørup 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>
> ---
> v5:
> * Do not inline the function. (Stephen)
> v4:
> * Consider multicast/broadcast packets unlikely.
> v3:
> * Eliminated a local variable.
> * Note: Substituted sizeof(uint32_t)*4 by 32UL, using unsigned long type
>    to keep optimal offsetting in generated assembler output.
> * Removed unnecessary curly braces.
> v2:
> * Fixed checkpatch warning about line length.
> ---
>   drivers/net/virtio/virtio_rxtx.c | 39 ++++++++++++--------------------
>   drivers/net/virtio/virtio_rxtx.h |  4 ++--
>   2 files changed, 16 insertions(+), 27 deletions(-)
>

Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Thanks,
Maxime



More information about the dev mailing list