1 commit 590032a4d2133ecc10d3078a8db1d85a4842f12c
2 Author: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Mon Apr 11 16:05:26 2022 +0200
5 page_pool: Add recycle stats to page_pool_put_page_bulk
7 Add missing recycle stats to page_pool_put_page_bulk routine.
9 Reviewed-by: Joe Damato <jdamato@fastly.com>
10 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
11 Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 Link: https://lore.kernel.org/r/3712178b51c007cfaed910ea80e68f00c916b1fa.1649685634.git.lorenzo@kernel.org
13 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
15 --- a/net/core/page_pool.c
16 +++ b/net/core/page_pool.c
18 this_cpu_inc(s->__stat); \
21 +#define recycle_stat_add(pool, __stat, val) \
23 + struct page_pool_recycle_stats __percpu *s = pool->recycle_stats; \
24 + this_cpu_add(s->__stat, val); \
27 bool page_pool_get_stats(struct page_pool *pool,
28 struct page_pool_stats *stats)
30 @@ -63,6 +69,7 @@ EXPORT_SYMBOL(page_pool_get_stats);
32 #define alloc_stat_inc(pool, __stat)
33 #define recycle_stat_inc(pool, __stat)
34 +#define recycle_stat_add(pool, __stat, val)
37 static int page_pool_init(struct page_pool *pool,
38 @@ -569,9 +576,13 @@ void page_pool_put_page_bulk(struct page
39 /* Bulk producer into ptr_ring page_pool cache */
40 page_pool_ring_lock(pool);
41 for (i = 0; i < bulk_len; i++) {
42 - if (__ptr_ring_produce(&pool->ring, data[i]))
43 - break; /* ring full */
44 + if (__ptr_ring_produce(&pool->ring, data[i])) {
46 + recycle_stat_inc(pool, ring_full);
50 + recycle_stat_add(pool, ring, i);
51 page_pool_ring_unlock(pool);
53 /* Hopefully all pages was return into ptr_ring */