[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8bcd9a94-6fb9-15ab-5a91-0b9d71cfa688@redhat.com>
Date: Mon, 28 Feb 2022 08:07:01 +0100
From: Jesper Dangaard Brouer <jbrouer@...hat.com>
To: Joe Damato <jdamato@...tly.com>, netdev@...r.kernel.org,
kuba@...nel.org, ilias.apalodimas@...aro.org, davem@...emloft.net,
hawk@...nel.org, saeed@...nel.org, ttoukan.linux@...il.com
Cc: brouer@...hat.com
Subject: Re: [net-next v7 1/4] page_pool: Add allocation stats
On 25/02/2022 18.41, Joe Damato wrote:
> Add per-pool statistics counters for the allocation path of a page pool.
> These stats are incremented in softirq context, so no locking or per-cpu
> variables are needed.
>
> This code is disabled by default and a kernel config option is provided for
> users who wish to enable them.
>
> The statistics added are:
> - fast: successful fast path allocations
> - slow: slow path order-0 allocations
> - slow_high_order: slow path high order allocations
> - empty: ptr ring is empty, so a slow path allocation was forced.
> - refill: an allocation which triggered a refill of the cache
> - waive: pages obtained from the ptr ring that cannot be added to
> the cache due to a NUMA mismatch.
>
> Signed-off-by: Joe Damato<jdamato@...tly.com>
> ---
> include/net/page_pool.h | 18 ++++++++++++++++++
> net/Kconfig | 13 +++++++++++++
> net/core/page_pool.c | 24 ++++++++++++++++++++----
> 3 files changed, 51 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/page_pool.h b/include/net/page_pool.h
> index 97c3c19..1f27e8a4 100644
> --- a/include/net/page_pool.h
> +++ b/include/net/page_pool.h
> @@ -84,6 +84,19 @@ struct page_pool_params {
> void *init_arg;
> };
>
> +#ifdef CONFIG_PAGE_POOL_STATS
> +struct page_pool_alloc_stats {
> + u64 fast; /* fast path allocations */
> + u64 slow; /* slow-path order 0 allocations */
> + u64 slow_high_order; /* slow-path high order allocations */
> + u64 empty; /* failed refills due to empty ptr ring, forcing
> + * slow path allocation
> + */
> + u64 refill; /* allocations via successful refill */
> + u64 waive; /* failed refills due to numa zone mismatch */
> +};
> +#endif
> +
> struct page_pool {
> struct page_pool_params p;
>
> @@ -96,6 +109,11 @@ struct page_pool {
> unsigned int frag_offset;
> struct page *frag_page;
> long frag_users;
> +
> +#ifdef CONFIG_PAGE_POOL_STATS
> + /* these stats are incremented while in softirq context */
> + struct page_pool_alloc_stats alloc_stats;
> +#endif
> u32 xdp_mem_id;
I like the cache-line placement.
Acked-by: Jesper Dangaard Brouer <brouer@...hat.com>
Powered by blists - more mailing lists