[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240621060504-mutt-send-email-mst@kernel.org>
Date: Fri, 21 Jun 2024 06:05:32 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Li RongQing <lirongqing@...du.com>
Cc: jasowang@...hat.com, xuanzhuo@...ux.alibaba.com, eperezma@...hat.com,
hengqi@...ux.alibaba.com, virtualization@...ts.linux.dev,
netdev@...r.kernel.org, kuba@...nel.org
Subject: Re: [PATCH][net-next,v2] virtio_net: Remove
u64_stats_update_begin()/end() for stats fetch
On Fri, Jun 21, 2024 at 05:45:52PM +0800, Li RongQing wrote:
> 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 <kuba@...nel.org>
> Signed-off-by: Li RongQing <lirongqing@...du.com>
I like the added comment, makes things clearer.
Acked-by: Michael S. Tsirkin <mst@...hat.com>
> ---
> drivers/net/virtio_net.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 61a57d1..6604339 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2336,12 +2336,12 @@ 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;
> --
> 2.9.4
Powered by blists - more mailing lists