From: Li RongQing Date: Fri, 21 Jun 2024 09:45:52 +0000 (+0800) Subject: virtio_net: Remove u64_stats_update_begin()/end() for stats fetch X-Git-Tag: v6.11-rc1~163^2~141 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d891317fe4fbe5a85522dccb66d3a159915d7983;p=thirdparty%2Fkernel%2Flinux.git virtio_net: Remove u64_stats_update_begin()/end() for stats fetch This place is fetching the stats, u64_stats_update_begin()/end() should not be used, and the fetcher of stats is in the same context as the updater of the stats, so don't need any protection Suggested-by: Jakub Kicinski Acked-by: Michael S. Tsirkin Signed-off-by: Li RongQing Link: https://lore.kernel.org/20240621094552.53469-1-lirongqing@baidu.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index b1f8b720733e5..f212977513107 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2382,12 +2382,13 @@ static void virtnet_rx_dim_update(struct virtnet_info *vi, struct receive_queue if (!rq->packets_in_napi) return; - u64_stats_update_begin(&rq->stats.syncp); + /* Don't need protection when fetching stats, since fetcher and + * updater of the stats are in same context + */ dim_update_sample(rq->calls, u64_stats_read(&rq->stats.packets), u64_stats_read(&rq->stats.bytes), &cur_sample); - u64_stats_update_end(&rq->stats.syncp); net_dim(&rq->dim, cur_sample); rq->packets_in_napi = 0;