mirror of
https://github.com/torvalds/linux.git
synced 2025-11-30 23:16:01 +07:00
blk-mq: fix stale tag depth for shared sched tags in blk_mq_update_nr_requests()
Commit7f2799c546("blk-mq: cleanup shared tags case in blk_mq_update_nr_requests()") moves blk_mq_tag_update_sched_shared_tags() before q->nr_requests is updated, however, it's still using the old q->nr_requests to resize tag depth. Fix this problem by passing in expected new tag depth. Fixes:7f2799c546("blk-mq: cleanup shared tags case in blk_mq_update_nr_requests()") Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Nilay Shroff <nilay@linux.ibm.com> Reported-by: Chris Mason <clm@meta.com> Link: https://lore.kernel.org/linux-block/20251014130507.4187235-2-clm@meta.com/ Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -557,7 +557,7 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e,
|
||||
if (blk_mq_is_shared_tags(flags)) {
|
||||
/* Shared tags are stored at index 0 in @et->tags. */
|
||||
q->sched_shared_tags = et->tags[0];
|
||||
blk_mq_tag_update_sched_shared_tags(q);
|
||||
blk_mq_tag_update_sched_shared_tags(q, et->nr_requests);
|
||||
}
|
||||
|
||||
queue_for_each_hw_ctx(q, hctx, i) {
|
||||
|
||||
@@ -622,10 +622,11 @@ void blk_mq_tag_resize_shared_tags(struct blk_mq_tag_set *set, unsigned int size
|
||||
sbitmap_queue_resize(&tags->bitmap_tags, size - set->reserved_tags);
|
||||
}
|
||||
|
||||
void blk_mq_tag_update_sched_shared_tags(struct request_queue *q)
|
||||
void blk_mq_tag_update_sched_shared_tags(struct request_queue *q,
|
||||
unsigned int nr)
|
||||
{
|
||||
sbitmap_queue_resize(&q->sched_shared_tags->bitmap_tags,
|
||||
q->nr_requests - q->tag_set->reserved_tags);
|
||||
nr - q->tag_set->reserved_tags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4941,7 +4941,7 @@ struct elevator_tags *blk_mq_update_nr_requests(struct request_queue *q,
|
||||
* tags can't grow, see blk_mq_alloc_sched_tags().
|
||||
*/
|
||||
if (q->elevator)
|
||||
blk_mq_tag_update_sched_shared_tags(q);
|
||||
blk_mq_tag_update_sched_shared_tags(q, nr);
|
||||
else
|
||||
blk_mq_tag_resize_shared_tags(set, nr);
|
||||
} else if (!q->elevator) {
|
||||
|
||||
@@ -186,7 +186,8 @@ void blk_mq_put_tag(struct blk_mq_tags *tags, struct blk_mq_ctx *ctx,
|
||||
void blk_mq_put_tags(struct blk_mq_tags *tags, int *tag_array, int nr_tags);
|
||||
void blk_mq_tag_resize_shared_tags(struct blk_mq_tag_set *set,
|
||||
unsigned int size);
|
||||
void blk_mq_tag_update_sched_shared_tags(struct request_queue *q);
|
||||
void blk_mq_tag_update_sched_shared_tags(struct request_queue *q,
|
||||
unsigned int nr);
|
||||
|
||||
void blk_mq_tag_wakeup_all(struct blk_mq_tags *tags, bool);
|
||||
void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_tag_iter_fn *fn,
|
||||
|
||||
Reference in New Issue
Block a user