[PATCH v5] virtio: optimize stats counters performance

lihuisong (C) lihuisong at huawei.com
Fri Aug 2 05:17:20 CEST 2024


在 2024/8/2 10:42, Stephen Hemminger 写道:
> On Fri, 2 Aug 2024 10:23:12 +0800
> "lihuisong (C)" <lihuisong at huawei.com> wrote:
>
>>>    void
>>> -virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf)
>>> +virtio_update_packet_stats(struct virtnet_stats *const stats,
>>> +		const struct rte_mbuf *const mbuf)
>> The two const is also for performace?  Is there gain?
> If you look at resulting code (ie godbolt.org) the resulting code never
> changes when const is added.  The compiler already
> knows what is modified. Const is only a programmer and correctness thing.
I know this. Thanks for your clarifying and recommending the site that 
is good to use.😁
This patch is just for optimizing stats counters performance.
And the new added const has nothing to do with this optimization.
But it's ok for me.
> .


More information about the dev mailing list