Skip to content

Commit

Permalink
blk-mq: clear hctx->dispatch_from when mappings change
Browse files Browse the repository at this point in the history
When the number of hardware queues is changed, the drivers will call
blk_mq_update_nr_hw_queues() to remap hardware queues. This changes
the ctx mappings, but the current code doesn't clear the
->dispatch_from hint. This can result in dispatch_from pointing to
a ctx that isn't mapped to the hctx anymore.

Fixes: b347689 ("blk-mq-sched: improve dispatching from sw queue")
Signed-off-by: huhai <huhai@kylinos.cn>
Reviewed-by: Ming Lei <ming.lei@redhat.com>

Moved the placement of the clearing to where we clear other items
pertaining to the existing mapping, added Fixes line, and reworded
the commit message.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
huhai authored and Jens Axboe committed May 18, 2018
1 parent 76aa1d3 commit d416c92
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2358,6 +2358,7 @@ static void blk_mq_map_swqueue(struct request_queue *q)
queue_for_each_hw_ctx(q, hctx, i) {
cpumask_clear(hctx->cpumask);
hctx->nr_ctx = 0;
hctx->dispatch_from = NULL;
}

/*
Expand Down

0 comments on commit d416c92

Please sign in to comment.