[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <988c920b-56b8-43f6-a42c-54e3ea6dc261@huawei.com>
Date: Tue, 8 Apr 2025 20:13:09 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
<linux-rdma@...r.kernel.org>, <linux-rt-devel@...ts.linux.dev>,
<netdev@...r.kernel.org>
CC: "David S. Miller" <davem@...emloft.net>, Andrew Lunn
<andrew+netdev@...n.ch>, Eric Dumazet <edumazet@...gle.com>, Ilias Apalodimas
<ilias.apalodimas@...aro.org>, Jakub Kicinski <kuba@...nel.org>, Jesper
Dangaard Brouer <hawk@...nel.org>, Joe Damato <jdamato@...tly.com>, Leon
Romanovsky <leon@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Saeed Mahameed
<saeedm@...dia.com>, Simon Horman <horms@...nel.org>, Tariq Toukan
<tariqt@...dia.com>, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH net-next v3 3/4] page_pool: Convert
page_pool_recycle_stats to u64_stats_t.
On 2025/4/8 18:59, Sebastian Andrzej Siewior wrote:
> Using u64 for statistics can lead to inconsistency on 32bit because an
> update and a read requires to access two 32bit values.
> This can be avoided by using u64_stats_t for the counters and
> u64_stats_sync for the required synchronisation on 32bit platforms. The
> synchronisation is a NOP on 64bit architectures.
>
> Use u64_stats_t for the counters in page_pool_recycle_stats.
> Add U64_STATS_ZERO, a static initializer for u64_stats_t.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
> Documentation/networking/page_pool.rst | 6 +--
> include/linux/u64_stats_sync.h | 5 +++
> include/net/page_pool/types.h | 13 ++++---
> net/core/page_pool.c | 52 ++++++++++++++++++--------
> net/core/page_pool_user.c | 10 ++---
> 5 files changed, 58 insertions(+), 28 deletions(-)
>
> diff --git a/Documentation/networking/page_pool.rst b/Documentation/networking/page_pool.rst
> index 9d958128a57cb..5215fd51a334a 100644
> --- a/Documentation/networking/page_pool.rst
> +++ b/Documentation/networking/page_pool.rst
> @@ -181,11 +181,11 @@ Stats
>
> #ifdef CONFIG_PAGE_POOL_STATS
> /* retrieve stats */
> - struct page_pool_stats stats = { 0 };
> + struct page_pool_stats stats = { };
> if (page_pool_get_stats(page_pool, &stats)) {
> /* perhaps the driver reports statistics with ethool */
> - ethtool_print_allocation_stats(&stats.alloc_stats);
> - ethtool_print_recycle_stats(&stats.recycle_stats);
> + ethtool_print_allocation_stats(u64_stats_read(&stats.alloc_stats));
> + ethtool_print_recycle_stats(u64_stats_read(&stats.recycle_stats));
The above seems like an unnecessary change? as stats.alloc_stats and
stats.recycle_stats are not really 'u64_stats_t' type.
Otherwise, LGTM.
Reviewed-by: Yunsheng Lin <linyunsheng@...wei.com>
Powered by blists - more mailing lists