All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] blk-mq: fix blk_mq_hw_ctx active request accounting
@ 2023-05-13 14:12 Tian Lan
  2023-05-13 16:41 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Tian Lan @ 2023-05-13 14:12 UTC (permalink / raw)
  To: axboe, linux-block; +Cc: Tian Lan

From: Tian Lan <tian.lan@twosigma.com>

The nr_active counter continues to increase over time which causes the
blk_mq_get_tag to hang until the thread is rescheduled to a different
core despite there are still tags available.

kernel-stack

  INFO: task inboundIOReacto:3014879 blocked for more than 2 seconds
  Not tainted 6.1.15-amd64 #1 Debian 6.1.15~debian11
  "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
  task:inboundIOReacto state:D stack:0  pid:3014879 ppid:4557 flags:0x00000000
    Call Trace:
    <TASK>
    __schedule+0x351/0xa20
    scheduler+0x5d/0xe0
    io_schedule+0x42/0x70
    blk_mq_get_tag+0x11a/0x2a0
    ? dequeue_task_stop+0x70/0x70
    __blk_mq_alloc_requests+0x191/0x2e0

kprobe output showing RQF_MQ_INFLIGHT bit is not cleared before
__blk_mq_free_request being called.

  320    320  kworker/29:1H __blk_mq_free_request rq_flags 0x220c0 in-flight 1
         b'__blk_mq_free_request+0x1 [kernel]'
         b'bt_iter+0x50 [kernel]'
         b'blk_mq_queue_tag_busy_iter+0x318 [kernel]'
         b'blk_mq_timeout_work+0x7c [kernel]'
         b'process_one_work+0x1c4 [kernel]'
         b'worker_thread+0x4d [kernel]'
         b'kthread+0xe6 [kernel]'
         b'ret_from_fork+0x1f [kernel]'

Signed-off-by: Tian Lan <tian.lan@twosigma.com>
---
 block/blk-mq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9c8dc70020bc..5b374fab169c 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1593,6 +1593,9 @@ void blk_mq_put_rq_ref(struct request *rq)
 		if (rq->end_io(rq, 0) == RQ_END_IO_FREE)
 			blk_mq_free_request(rq);
 	} else if (req_ref_put_and_test(rq)) {
+		if (rq->rq_flags & RQF_MQ_INFLIGHT)
+			__blk_mq_dec_active_requests(rq->mq_hctx)
+
 		__blk_mq_free_request(rq);
 	}
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-06-04  0:47 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-13 14:12 [PATCH 1/1] blk-mq: fix blk_mq_hw_ctx active request accounting Tian Lan
2023-05-13 16:41 ` kernel test robot
2023-05-13 16:41 ` kernel test robot
2023-05-13 19:05   ` Tian Lan
2023-05-13 20:54     ` Simon Horman
2023-05-13 21:15       ` Jens Axboe
2023-05-13 22:11         ` Tian Lan
2023-05-14  1:39           ` Jens Axboe
2023-05-15 12:28             ` Tian Lan
2023-05-13 22:12         ` Tian Lan
2023-05-14  1:52           ` Jens Axboe
2023-05-14 12:20             ` Ming Lei
2023-06-03 22:39             ` [PATCH] " Tian Lan
2023-06-04  0:47               ` Ming Lei
2023-06-03 22:39             ` [PATCH 1/1] " Tian Lan
2023-05-14 14:22           ` Ming Lei
2023-05-14 14:28             ` Tian Lan
2023-05-14 14:53             ` [PATCH] " Tian Lan
2023-05-15  5:54               ` Hannes Reinecke
2023-05-15 12:26                 ` Tian Lan
2023-05-25  2:12                   ` Ming Lei
2023-06-03 23:20           ` [PATCH 1/1] " Jens Axboe
2023-05-14 12:08     ` Ming Lei
2023-05-14 14:12       ` Tian Lan
2023-05-14 14:15       ` Ming Lei
2023-05-13 19:11   ` Tian Lan
2023-05-13 16:52 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.