From: Joe Damato <jdamato@fastly.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Eric Dumazet <edumazet@google.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Leon Romanovsky <leon@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Simon Horman <horms@kernel.org>, Tariq Toukan <tariqt@nvidia.com>,
Thomas Gleixner <tglx@linutronix.de>,
Yunsheng Lin <linyunsheng@huawei.com>
Subject: Re: [PATCH net-next 2/2] page_pool: Convert page_pool_alloc_stats to u64_stats_t.
Date: Fri, 21 Feb 2025 12:30:12 -0500 [thread overview]
Message-ID: <Z7i4JPCZHbbP0OLS@LQ3V64L9R2> (raw)
In-Reply-To: <20250221115221.291006-3-bigeasy@linutronix.de>
On Fri, Feb 21, 2025 at 12:52:21PM +0100, 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.
Same as in previous messages: I'd want to see clearly that this is
indeed an issue on 32bit systems showing before/after assembly.
> Use u64_stats_t for the counters in page_pool_recycle_stats.
Commit message says page_pool_recycle_stats, but code below is for
alloc stats.
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> .../ethernet/mellanox/mlx5/core/en_stats.c | 12 ++---
> include/net/page_pool/types.h | 14 +++---
> net/core/page_pool.c | 45 +++++++++++++------
> net/core/page_pool_user.c | 12 ++---
> 4 files changed, 52 insertions(+), 31 deletions(-)
[...]
> --- a/include/net/page_pool/types.h
> +++ b/include/net/page_pool/types.h
> @@ -96,6 +96,7 @@ struct page_pool_params {
> #ifdef CONFIG_PAGE_POOL_STATS
> /**
> * struct page_pool_alloc_stats - allocation statistics
> + * @syncp: synchronisations point for updates.
> * @fast: successful fast path allocations
> * @slow: slow path order-0 allocations
> * @slow_high_order: slow path high order allocations
> @@ -105,12 +106,13 @@ struct page_pool_params {
> * the cache due to a NUMA mismatch
> */
> struct page_pool_alloc_stats {
> - u64 fast;
> - u64 slow;
> - u64 slow_high_order;
> - u64 empty;
> - u64 refill;
> - u64 waive;
> + struct u64_stats_sync syncp;
> + u64_stats_t fast;
> + u64_stats_t slow;
> + u64_stats_t slow_high_order;
> + u64_stats_t empty;
> + u64_stats_t refill;
> + u64_stats_t waive;
> };
When I tried to get this in initially, Jesper had feelings about the
cacheline placement of the counters. I have no idea if that is still
the case or not.
My suggestion to you (assuming that your initial assertion is
correct that this_cpu_inc isn't safe on 32bit x86) would be to:
- include pahole output showing the placement of these counters
- include the same benchmarks I included in the original series
[1] that Jesper requested from me. I believe the code for the
benchmarks can be found here:
https://github.com/netoptimizer/prototype-kernel/tree/master/kernel/lib
That would probably make it easier for the page pool people to
review / ack and would likely result in fewer revisions.
[1]: https://lore.kernel.org/all/1646172610-129397-1-git-send-email-jdamato@fastly.com/
next prev parent reply other threads:[~2025-02-21 17:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 11:52 [PATCH net-next 0/2] page_pool: Convert stats to u64_stats_t Sebastian Andrzej Siewior
2025-02-21 11:52 ` [PATCH net-next 1/2] page_pool: Convert page_pool_recycle_stats " Sebastian Andrzej Siewior
2025-02-21 17:21 ` Joe Damato
2025-02-26 12:06 ` Sebastian Andrzej Siewior
2025-02-22 8:13 ` Yunsheng Lin
2025-02-25 11:27 ` Paolo Abeni
2025-02-26 9:28 ` Sebastian Andrzej Siewior
2025-02-21 11:52 ` [PATCH net-next 2/2] page_pool: Convert page_pool_alloc_stats " Sebastian Andrzej Siewior
2025-02-21 17:30 ` Joe Damato [this message]
2025-02-22 8:13 ` Yunsheng Lin
2025-02-21 17:10 ` [PATCH net-next 0/2] page_pool: Convert stats " Joe Damato
2025-02-26 10:27 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z7i4JPCZHbbP0OLS@LQ3V64L9R2 \
--to=jdamato@fastly.com \
--cc=andrew+netdev@lunn.ch \
--cc=bigeasy@linutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linyunsheng@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.