Skip to contentSkip to conversation

blk-mq: add missing unplug trace event

PATCH Applied Keith Busch 2 participants 2 messages Sep 6, 2024 – Sep 8, 2024 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk-mq: add missing unplug trace event

From: Keith Busch <[email protected]>

The single-queue optimized list flush doesn't have an unplug trace event to pair with the plug event. Add one.

In the unlikely event an error occurs and falls back to the less optimized plug flush path, it's possible a 2nd unplug trace event will be logged, but it will show the remainig count that weren't previously handled.

---
 block/blk-mq.c | 3 +++
 1 file changed, 3 insertions(+)
block/blk-mq.c +3 -0
index 79cc66275f1cd..3076019a9e0a7 100644
@@ -2757,6 +2757,7 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched)
 void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 {
 	struct request *rq;
+	unsigned int depth;
 
 	/*
 	 * We may have been called recursively midway through handling
@@ -2767,6 +2768,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 	 */
 	if (plug->rq_count == 0)
 		return;
+	depth = plug->rq_count;
 	plug->rq_count = 0;
 
 	if (!plug->multiple_queues && !plug->has_elevator && !from_schedule) {
@@ -2774,6 +2776,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 
 		rq = rq_list_peek(&plug->mq_list);
 		q = rq->q;
+		trace_block_unplug(q, depth, true);
 
 		/*
 		 * Peek first request and see if we have a ->queue_rqs() hook.
Signature · 1 line
2.43.5
maintainer Applied
#1 lore raw
Quoted 9 lines · Keith Busch

The single-queue optimized list flush doesn't have an unplug trace event to pair with the plug event. Add one.

In the unlikely event an error occurs and falls back to the less optimized plug flush path, it's possible a 2nd unplug trace event will be logged, but it will show the remainig count that weren't previously handled.

[...]

Applied, thanks!

[1/1] blk-mq: add missing unplug trace event

      commit: acc8c0a9887558966295e3c0881e633154c239a9

Best regards,

Signature · 1 line
Jens Axboe