]> git.hungrycats.org Git - linux/commitdiff
blk-mq: keep sharing tags fairly after a queue update
authorJosef Bacik <josef@toxicpanda.com>
Wed, 28 Oct 2026 16:41:32 +0000 (10:41 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 29 Oct 2026 13:15:47 +0000 (07:15 -0600)
A hctx only gets BLK_MQ_F_TAG_QUEUE_SHARED from
blk_mq_add_queue_tag_set(). The hctxs blk_mq_update_nr_hw_queues()
allocates for queues that joined long ago never get it, so they aren't
counted in active_queues and hctx_may_queue() lets them take all the
tags. One NVMe namespace can starve the others after the first update.

Set the flag on the new hctxs.

Fixes: 868f2f0b7206 ("blk-mq: dynamic h/w context count")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261028164415.1262013-30-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index c5068f065ccb3aaf8425f1915f2be8f3d37d11d0..70253eaab0886c67d76ecbc184316b6c43e2c982 100644 (file)
@@ -5183,6 +5183,9 @@ fallback:
                        goto fallback;
                }
                blk_mq_map_swqueue(q);
+               /* The new hctxs don't know yet that they share their tags */
+               if (set->flags & BLK_MQ_F_TAG_QUEUE_SHARED)
+                       queue_set_hctx_shared(q, true);
        }
 switch_back:
        /* The blk_mq_elv_switch_back unfreezes queue for us. */