Add event tracing to show how many poll/wq requests were retargeted Signed-off-by: Dylan Yudaken <dylany@xxxxxxxx> --- include/trace/events/io_uring.h | 30 ++++++++++++++++++++++++++++++ io_uring/rsrc.c | 2 ++ 2 files changed, 32 insertions(+) diff --git a/include/trace/events/io_uring.h b/include/trace/events/io_uring.h index 936fd41bf147..b47be89dd270 100644 --- a/include/trace/events/io_uring.h +++ b/include/trace/events/io_uring.h @@ -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 */ diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 40b37899e943..00402533cee5 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -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) -- 2.30.2