@@ -684,6 +684,36 @@ TRACE_EVENT(io_uring_local_work_run,
TP_printk("ring %p, count %d, loops %u", __entry->ctx, __entry->count, __entry->loops)
);
+/*
+ * io_uring_rsrc_retarget - ran a rsrc retarget
+ *
+ * @ctx: pointer to a io_uring_ctx
+ * @poll: how many retargeted that were polling
+ * @wq: how many retargeted that were in the wq
+ *
+ */
+TRACE_EVENT(io_uring_rsrc_retarget,
+
+ TP_PROTO(void *ctx, unsigned int poll, unsigned int wq),
+
+ TP_ARGS(ctx, poll, wq),
+
+ TP_STRUCT__entry(
+ __field(void *, ctx)
+ __field(unsigned int, poll)
+ __field(unsigned int, wq)
+ ),
+
+ TP_fast_assign(
+ __entry->ctx = ctx;
+ __entry->poll = poll;
+ __entry->wq = wq;
+ ),
+
+ TP_printk("ring %p, poll %u, wq %u",
+ __entry->ctx, __entry->poll, __entry->wq)
+);
+
#endif /* _TRACE_IO_URING_H */
/* This part must be outside protection */
@@ -325,6 +325,8 @@ static void __io_rsrc_retarget_work(struct io_ring_ctx *ctx)
ctx->rsrc_cached_refs -= (poll_refs + data.refs);
while (unlikely(ctx->rsrc_cached_refs < 0))
io_rsrc_refs_refill(ctx);
+
+ trace_io_uring_rsrc_retarget(ctx, poll_refs, data.refs);
}
void io_rsrc_retarget_work(struct work_struct *work)
Add event tracing to show how many poll/wq requests were retargeted Signed-off-by: Dylan Yudaken <dylany@meta.com> --- include/trace/events/io_uring.h | 30 ++++++++++++++++++++++++++++++ io_uring/rsrc.c | 2 ++ 2 files changed, 32 insertions(+)