Patch "blk-mq: wait on correct sbitmap_queue in blk_mq_mark_tag_wait" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    blk-mq: wait on correct sbitmap_queue in blk_mq_mark_tag_wait

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     blk-mq-wait-on-correct-sbitmap_queue-in-blk_mq_mark_.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 748d32e1d793e736693bc5afd2dbff0e5aa1ef6a
Author: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
Date:   Wed Jan 18 17:37:15 2023 +0800

    blk-mq: wait on correct sbitmap_queue in blk_mq_mark_tag_wait
    
    [ Upstream commit 98b99e9412d0cde8c7b442bf5efb09528a2ede8b ]
    
    For shared queues case, we will only wait on bitmap_tags if we fail to get
    driver tag. However, rq could be from breserved_tags, then two problems
    will occur:
    1. io hung if no tag is currently allocated from bitmap_tags.
    2. unnecessary wakeup when tag is freed to bitmap_tags while no tag is
    freed to breserved_tags.
    Wait on the bitmap which rq from to fix this.
    
    Fixes: f906a6a0f426 ("blk-mq: improve tag waiting setup for non-shared tags")
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 84798d09ca464..325a5944b4cb2 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1112,7 +1112,7 @@ static int blk_mq_dispatch_wake(wait_queue_entry_t *wait, unsigned mode,
 static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx,
 				 struct request *rq)
 {
-	struct sbitmap_queue *sbq = &hctx->tags->bitmap_tags;
+	struct sbitmap_queue *sbq;
 	struct wait_queue_head *wq;
 	wait_queue_entry_t *wait;
 	bool ret;
@@ -1135,6 +1135,10 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx,
 	if (!list_empty_careful(&wait->entry))
 		return false;
 
+	if (blk_mq_tag_is_reserved(rq->mq_hctx->sched_tags, rq->internal_tag))
+		sbq = &hctx->tags->breserved_tags;
+	else
+		sbq = &hctx->tags->bitmap_tags;
 	wq = &bt_wait_ptr(sbq, hctx)->wait;
 
 	spin_lock_irq(&wq->lock);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux