On Mon, 2018-02-05 at 23:20 +0800, Ming Lei wrote: > diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c > index 55c0a745b427..385bbec73804 100644 > --- a/block/blk-mq-sched.c > +++ b/block/blk-mq-sched.c > @@ -81,6 +81,17 @@ static bool blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx > *hctx) > } else > clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state); > > + /* need to restart all hw queues for global tags */ > + if (hctx->flags & BLK_MQ_F_GLOBAL_TAGS) { > + struct blk_mq_hw_ctx *hctx2; > + int i; > + > + queue_for_each_hw_ctx(hctx->queue, hctx2, i) > + if (blk_mq_run_hw_queue(hctx2, true)) > + return true; > + return false; > + } > + > return blk_mq_run_hw_queue(hctx, true); > }
This new loop looks misplaced to me. If both the BLK_MQ_F_GLOBAL_TAGS and the BLK_MQ_F_TAG_SHARED flags are set then the outer loop in blk_mq_sched_restart() and the inner loop in blk_mq_sched_restart_hctx() will cause more calls of blk_mq_run_hw_queue() than necessary. Have you considered to merge the above loop into blk_mq_sched_restart()? Thanks, Bart.