All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blk-mq: avoid to account active request repeatedly
@ 2020-07-02 13:58 Ming Lei
  0 siblings, 0 replies; only message in thread
From: Ming Lei @ 2020-07-02 13:58 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei, Qian Cai, Sachin Sant

One request may get driver tag several times, and active request is only
de-accounted in blk_mq_put_driver_tag() in case of io scheduler, and it
won't be done for none, so repeated accounting of active request may
happen.

Fix this issue by only accounting active request in case that RQF_MQ_INFLIGHT
isn't set.

Cc: Qian Cai <cai@lca.pw>
Tested-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Fixes: 37f4a24c2469 ("blk-mq: centralise related handling into blk_mq_get_driver_tag")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 6b36969220c1..656d92de9814 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1149,7 +1149,8 @@ static bool blk_mq_get_driver_tag(struct request *rq)
 	if (rq->tag == BLK_MQ_NO_TAG && !__blk_mq_get_driver_tag(rq))
 		return false;
 
-	if (hctx->flags & BLK_MQ_F_TAG_SHARED) {
+	if ((hctx->flags & BLK_MQ_F_TAG_SHARED) &&
+			!(rq->rq_flags & RQF_MQ_INFLIGHT)) {
 		rq->rq_flags |= RQF_MQ_INFLIGHT;
 		atomic_inc(&hctx->nr_active);
 	}
-- 
2.25.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-02 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 13:58 [PATCH] blk-mq: avoid to account active request repeatedly Ming Lei

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.