From: Yu Kuai <yukuai3@xxxxxxxxxx> This is not a formal version and not fully tested, I send this RFC because I want to make sure if people think doing this is meaningful, before I spend too much time on this. This patchset tries to refactor how tag is shared: - patch 2 delay tag sharing from issue io to when get driver tag faild; - patch 3 support to access which queues/hctxs is sharing tags through blk_mq_tags; - patch 4 move the caculation that how many tags is available from hctx_may_queue() to when queue/hctx start or stop to sharing tags. - patch 5 record new information that how many times fail to get driver tag recently; And patch 7 use this to adjust available tags for each shared queue. Yu Kuai (7): blk-mq: factor out a structure from blk_mq_tags to control tag sharing blk-mq: delay tag fair sharing until fail to get driver tag blk-mq: support to track active queues from blk_mq_tags blk-mq: precalculate available tags for hctx_may_queue() blk-mq: record the number of times fail to get driver tag while sharing tags blk-mq: move active request counter to struct tag_sharing blk-mq: allow shared queue to get more driver tags block/blk-core.c | 2 - block/blk-mq-debugfs.c | 6 +- block/blk-mq-tag.c | 154 ++++++++++++++++++++++++++++++++++++++--- block/blk-mq.c | 10 ++- block/blk-mq.h | 39 ++++++----- include/linux/blk-mq.h | 24 ++++--- include/linux/blkdev.h | 13 +++- 7 files changed, 201 insertions(+), 47 deletions(-) -- 2.39.2