[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1643933373-6590-5-git-send-email-jdamato@fastly.com>
Date: Thu, 3 Feb 2022 16:09:26 -0800
From: Joe Damato <jdamato@...tly.com>
To: netdev@...r.kernel.org, kuba@...nel.org,
ilias.apalodimas@...aro.org, davem@...emloft.net, hawk@...nel.org,
saeed@...nel.org, ttoukan.linux@...il.com, brouer@...hat.com
Cc: Joe Damato <jdamato@...tly.com>
Subject: [net-next v4 04/11] page_pool: Add macro for incrementing alloc stats
Add macro incrementing per pool per cpu stats.
Signed-off-by: Joe Damato <jdamato@...tly.com>
---
net/core/page_pool.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 5f822b0..180e48b 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -26,6 +26,19 @@
#define BIAS_MAX LONG_MAX
+#ifdef CONFIG_PAGE_POOL_STATS
+/*
+ * this_cpu_inc_alloc_stat is intended to be used in softirq context
+ */
+#define this_cpu_inc_alloc_stat(pool, __stat) \
+ do { \
+ struct page_pool_stats __percpu *s = pool->stats; \
+ __this_cpu_inc(s->alloc.__stat); \
+ } while (0)
+#else
+#define this_cpu_inc_alloc_stat(pool, __stat)
+#endif
+
static int page_pool_init(struct page_pool *pool,
const struct page_pool_params *params)
{
--
2.7.4
Powered by blists - more mailing lists