Re: [PATCH] blk-mq: add tracepoint block_rq_tag_wait

From: Aaron Tomlin

Date: Wed Mar 18 2026 - 09:21:45 EST


On Wed, Mar 18, 2026 at 08:38:20AM +0900, Damien Le Moal wrote:
> Looks OK to me, but I have some suggestions below.

Hi Damien,

Thank you for your feedback.

> > +/**
> > + * block_rq_tag_wait - triggered when an I/O request is starved of a
> > tag
>
> when an I/O request -> when a request

Acknowledged.

>
> > + * @q: queue containing the request
>
> request queue of the target device
>
> ("containing" is odd here)

Acknowledged.

> > + * @hctx: hardware context (queue) experiencing starvation
>
> hardware context of the request

Acknowledged.

> > + *
> > + * Called immediately before the submitting thread is forced to block due
>
> the submitting thread -> the submitting context

Acknowledged.

>
> > + * to the exhaustion of available hardware tags. This tracepoint indicates
>
> s/tracepoint/trace point

Acknowledged.

>
> > + * that the thread will be placed into an uninterruptible state via
>
> s/thread/context

Acknowledged.

>
> > + * io_schedule() until an active block I/O operation completes and
> > + * relinquishes its assigned tag.
>
> until an active request completes
>

Acknowledged.

> > + */
> > +TRACE_EVENT(block_rq_tag_wait,
> > +
> > + TP_PROTO(struct request_queue *q, struct blk_mq_hw_ctx *hctx),
> > +
> > + TP_ARGS(q, hctx),
> > +
> > + TP_STRUCT__entry(
> > + __field( dev_t, dev )
> > + __field( u32, hctx_id )
> > + __field( u32, nr_tags )
> > + __field( u32, active_requests )
> > + ),
> > +
> > + TP_fast_assign(
> > + __entry->dev = q->disk ? disk_devt(q->disk) : 0;
>
> I do not think that q->disk can ever be NULL when there is a request being
> submitted.

Yes, I agree. In theory, a race with disk_release() cannot occur since the
gendisk reference counter would still be elevated here.

>
> > + __entry->hctx_id = hctx ? hctx->queue_num : 0;
> > + __entry->nr_tags = hctx && hctx->tags ? hctx->tags->nr_tags : 0;
> > + __entry->active_requests = hctx ? atomic_read(&hctx->nr_active) : 0;
> > + ),
> > +
> > + TP_printk("%d,%d hctx=%u starved (active=%u/%u)",
> > + MAJOR(__entry->dev), MINOR(__entry->dev),
> > + __entry->hctx_id, __entry->active_requests, __entry->nr_tags)
> > +);
> > +
> > /**
> > * block_rq_insert - insert block operation request into queue
> > * @rq: block IO operation request


Kind regards,
--
Aaron Tomlin

Attachment: signature.asc
Description: PGP signature