Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

blk-mq: cleanup shared tags case in blk_mq_update_nr_requests()

For shared tags case, all hctx->sched_tags/tags are the same, it doesn't
make sense to call into blk_mq_tag_update_depth() multiple times for the
same tags.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Yu Kuai and committed by
Jens Axboe
7f2799c5 626ff4f8

+22 -28
-7
block/blk-mq-tag.c
··· 622 622 struct blk_mq_tag_set *set = hctx->queue->tag_set; 623 623 struct blk_mq_tags *new; 624 624 625 - /* 626 - * Only the sbitmap needs resizing since we allocated the max 627 - * initially. 628 - */ 629 - if (blk_mq_is_shared_tags(set->flags)) 630 - return 0; 631 - 632 625 new = blk_mq_alloc_map_and_rqs(set, hctx->queue_num, tdepth); 633 626 if (!new) 634 627 return -ENOMEM;
+22 -21
block/blk-mq.c
··· 4935 4935 4936 4936 blk_mq_quiesce_queue(q); 4937 4937 4938 - queue_for_each_hw_ctx(q, hctx, i) { 4939 - if (!hctx->tags) 4940 - continue; 4941 - /* 4942 - * If we're using an MQ scheduler, just update the scheduler 4943 - * queue depth. This is similar to what the old code would do. 4944 - */ 4945 - if (hctx->sched_tags) { 4946 - ret = blk_mq_tag_update_depth(hctx, &hctx->sched_tags, 4947 - nr); 4948 - } else { 4949 - ret = blk_mq_tag_update_depth(hctx, &hctx->tags, nr); 4950 - } 4951 - if (ret) 4952 - goto out; 4953 - } 4954 - 4955 - q->nr_requests = nr; 4956 - if (q->elevator && q->elevator->type->ops.depth_updated) 4957 - q->elevator->type->ops.depth_updated(q); 4958 - 4959 4938 if (blk_mq_is_shared_tags(set->flags)) { 4960 4939 if (q->elevator) 4961 4940 blk_mq_tag_update_sched_shared_tags(q); 4962 4941 else 4963 4942 blk_mq_tag_resize_shared_tags(set, nr); 4943 + } else { 4944 + queue_for_each_hw_ctx(q, hctx, i) { 4945 + if (!hctx->tags) 4946 + continue; 4947 + /* 4948 + * If we're using an MQ scheduler, just update the 4949 + * scheduler queue depth. This is similar to what the 4950 + * old code would do. 4951 + */ 4952 + if (hctx->sched_tags) 4953 + ret = blk_mq_tag_update_depth(hctx, 4954 + &hctx->sched_tags, nr); 4955 + else 4956 + ret = blk_mq_tag_update_depth(hctx, 4957 + &hctx->tags, nr); 4958 + if (ret) 4959 + goto out; 4960 + } 4964 4961 } 4962 + 4963 + q->nr_requests = nr; 4964 + if (q->elevator && q->elevator->type->ops.depth_updated) 4965 + q->elevator->type->ops.depth_updated(q); 4965 4966 4966 4967 out: 4967 4968 blk_mq_unquiesce_queue(q);