Skip to content

Commit

Permalink
page_pool: Add recycle stats to page_pool_put_page_bulk
Browse files Browse the repository at this point in the history
Add missing recycle stats to page_pool_put_page_bulk routine.

Reviewed-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Link: https://lore.kernel.org/r/3712178b51c007cfaed910ea80e68f00c916b1fa.1649685634.git.lorenzo@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Lorenzo Bianconi authored and Paolo Abeni committed Apr 12, 2022
1 parent ec09526 commit 590032a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions net/core/page_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
this_cpu_inc(s->__stat); \
} while (0)

#define recycle_stat_add(pool, __stat, val) \
do { \
struct page_pool_recycle_stats __percpu *s = pool->recycle_stats; \
this_cpu_add(s->__stat, val); \
} while (0)

bool page_pool_get_stats(struct page_pool *pool,
struct page_pool_stats *stats)
{
Expand Down Expand Up @@ -63,6 +69,7 @@ EXPORT_SYMBOL(page_pool_get_stats);
#else
#define alloc_stat_inc(pool, __stat)
#define recycle_stat_inc(pool, __stat)
#define recycle_stat_add(pool, __stat, val)
#endif

static int page_pool_init(struct page_pool *pool,
Expand Down Expand Up @@ -566,9 +573,13 @@ void page_pool_put_page_bulk(struct page_pool *pool, void **data,
/* Bulk producer into ptr_ring page_pool cache */
page_pool_ring_lock(pool);
for (i = 0; i < bulk_len; i++) {
if (__ptr_ring_produce(&pool->ring, data[i]))
break; /* ring full */
if (__ptr_ring_produce(&pool->ring, data[i])) {
/* ring full */
recycle_stat_inc(pool, ring_full);
break;
}
}
recycle_stat_add(pool, ring, i);
page_pool_ring_unlock(pool);

/* Hopefully all pages was return into ptr_ring */
Expand Down

0 comments on commit 590032a

Please sign in to comment.