From: huhai Date: Fri, 18 May 2018 14:32:30 +0000 (-0600) Subject: blk-mq: clear hctx->dispatch_from when mappings change X-Git-Tag: v4.18-rc1~192^2~89 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=d416c92c5d6229b33f37f0f75e52194081ccbcc4;p=linux.git blk-mq: clear hctx->dispatch_from when mappings change 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: b347689ffbca ("blk-mq-sched: improve dispatching from sw queue") Signed-off-by: huhai Reviewed-by: Ming Lei 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 --- diff --git a/block/blk-mq.c b/block/blk-mq.c index 6c6aef44badd..4cbfd784e837 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -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; } /*