page_pool: Add page_pool_release_stalled tracepoint
Subsystems (4)
PATCH v2 1/1 page_pool: Add page_pool_release_stalled tracepoint
Introduce a new tracepoint to track stalled page pool releases, providing better observability for page pool lifecycle issues.
Problem:
Currently, when a page pool shutdown is stalled due to inflight pages, the kernel only logs a warning message via pr_warn(). This has several limitations:
1. The warning floods the kernel log after the initial DEFER_WARN_INTERVAL, making it difficult to track the progression of stalled releases
2. There's no structured way to monitor or analyze these events
3. Debugging tools cannot easily capture and correlate stalled pool events with other network activity
Solution:
Add a new tracepoint, page_pool_release_stalled, that fires when a page pool shutdown is stalled. The tracepoint captures:
- pool: pointer to the stalled page_pool
- inflight: number of pages still in flight
- sec: seconds since the release was deferred
The implementation also modifies the logging behavior:
- pr_warn() is only emitted during the first warning interval (DEFER_WARN_INTERVAL to DEFER_WARN_INTERVAL*2)
- The tracepoint is fired always, reducing log noise while still allowing monitoring tools to track the issue
This allows developers and system administrators to:
- Use tools like perf, ftrace, or eBPF to monitor stalled releases
- Correlate page pool issues with network driver behavior
- Analyze patterns without parsing kernel logs
- Track the progression of inflight page counts over time
---
v1 -> v2:
- Drop RFC.
- Store 'pool->user.id' to '__entry->id' (per Steven Rostedt).
- https://lore.kernel.org/netdev/[email protected]/
--- include/trace/events/page_pool.h | 24 ++++++++++++++++++++++++ net/core/page_pool.c | 6 ++++-- 2 files changed, 28 insertions(+), 2 deletions(-)
include/trace/events/page_pool.h +24 -0
@@ -113,6 +113,30 @@ TRACE_EVENT(page_pool_update_nid, __entry->pool, __entry->pool_nid, __entry->new_nid) ); +TRACE_EVENT (page_pool_release_stalled, + + TP_PROTO(const struct page_pool *pool, int inflight, int sec), + +TP_ARGS (pool, inflight, sec), + +TP_STRUCT__entry ( + __field(const struct page_pool *, pool) + __field(u32, id) + __field(int, inflight) +__field (int, sec) + ), + +TP_fast_assign ( + __entry->pool = pool; + __entry->id = pool->user.id; + __entry->inflight = inflight; + __entry->sec = sec; + ), + +TP_printk ("page_pool=%p id=%d inflight=%d sec=%d" , + __entry->pool, __entry->id, __entry->inflight, __entry->sec) +); +#endif /* _TRACE_PAGE_POOL_H */ /* This part must be outside protection */
net/core/page_pool.c +4 -2
@@ -1222,8 +1222,10 @@ static void page_pool_release_retry(struct work_struct *wq) (!netdev || netdev == NET_PTR_POISON)) {int sec = (s32)((u32 )jiffies - (u32 )pool->defer_start) /HZ ; -pr_warn ("%s() stalled pool shutdown: id %u, %d inflight %d sec\n" , - __func__, pool->user.id, inflight, sec); +if (sec >=DEFER_WARN_INTERVAL /HZ && sec <DEFER_WARN_INTERVAL *2 /HZ ) +pr_warn ("%s() stalled pool shutdown: id %u, %d inflight %d sec\n" , + __func__, pool->user.id, inflight, sec); +trace_page_pool_release_stalled (pool, inflight, sec); pool->defer_warn = jiffies +DEFER_WARN_INTERVAL ; }
Signature · 1 line
2.52.0
Quoted 23 lines · On Fri, 2 Jan 2026 14:17:18 +0800 Leon Hwang <[email protected]> wrote:
include/trace/events/page_pool.h +15
-0@@ -113,6 +113,30 @@ TRACE_EVENT(page_pool_update_nid, __entry->pool, __entry->pool_nid, __entry->new_nid) ); +TRACE_EVENT(page_pool_release_stalled, + + TP_PROTO(const struct page_pool *pool, int inflight, int sec), + + TP_ARGS(pool, inflight, sec), + + TP_STRUCT__entry( + __field(const struct page_pool *, pool) + __field(u32, id) + __field(int, inflight) + __field(int, sec) + ), + + TP_fast_assign( + __entry->pool = pool;
include/trace/events/page_pool.h TRACE_EVENT(page_pool_update_nid, · line 140
Quoted 10 lines
include/trace/events/page_pool.h +9
-0+ __entry->id = pool->user.id; + __entry->inflight = inflight; + __entry->sec = sec; + ), + +TP_printk ("page_pool=%p id=%d inflight=%d sec=%d" , + __entry->pool, __entry->id, __entry->inflight, __entry->sec) +); +#endif /* _TRACE_PAGE_POOL_H */
From a tracing POV, I see nothing wrong with this.
-- Steve
Quoted 39 lines · Steven Rostedt
Quoted 23 lines · On Fri, 2 Jan 2026 14:17:18 +0800 Leon Hwang <[email protected]> wrote:
include/trace/events/page_pool.h +15
-0@@ -113,6 +113,30 @@ TRACE_EVENT(page_pool_update_nid, __entry->pool, __entry->pool_nid, __entry->new_nid) ); +TRACE_EVENT(page_pool_release_stalled, + + TP_PROTO(const struct page_pool *pool, int inflight, int sec), + + TP_ARGS(pool, inflight, sec), + + TP_STRUCT__entry( + __field(const struct page_pool *, pool) + __field(u32, id) + __field(int, inflight) + __field(int, sec) + ), + + TP_fast_assign( + __entry->pool = pool;include/trace/events/page_pool.h TRACE_EVENT(page_pool_update_nid, · line 140
Quoted 10 lines
include/trace/events/page_pool.h +9
-0+ __entry->id = pool->user.id; + __entry->inflight = inflight; + __entry->sec = sec; + ), + +TP_printk ("page_pool=%p id=%d inflight=%d sec=%d" , + __entry->pool, __entry->id, __entry->inflight, __entry->sec) +); +#endif /* _TRACE_PAGE_POOL_H */ From a tracing POV, I see nothing wrong with this.
Quoted 3 lines
Reviewed-by Steven Rostedt (Google) <[email protected]>-- Steve
Hi Steve,
Thanks for the review!
I realized the id should be printed with '%u', so I've sent out v3 [1] with that adjustment.
Links:
[1]
https://lore.kernel.org/netdev/[email protected]/
Thanks,
Leon
Steven Rostedt
maintainerQuoted 8 lines · On Fri, 2 Jan 2026 23:54:20 +0800 Leon Hwang <[email protected]> wrote:
Thanks for the review!
I realized the id should be printed with '%u', so I've sent out v3 [1] with that adjustment.
Feel free to add my r-b tag to that one as well.
-- Steve