diff options
| author | Ming Lei <ming.lei@redhat.com> | 2018-04-08 05:48:07 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2018-04-10 10:38:46 -0400 |
| commit | a1c735fb790745f94a359df45c11df4a69760389 (patch) | |
| tree | 0ec9fdf86086885756ceecadb154c44eec8973bf /block | |
| parent | bdac616db9bbadb90b7d6a406144571015e138f7 (diff) | |
blk-mq: make sure that correct hctx->next_cpu is set
From commit 20e4d81393196 (blk-mq: simplify queue mapping & schedule
with each possisble CPU), one hctx can be mapped from all offline CPUs,
then hctx->next_cpu can be set as wrong.
This patch fixes this issue by making hctx->next_cpu pointing to the
first CPU in hctx->cpumask if all CPUs in hctx->cpumask are offline.
Cc: Stefan Haberland <sth@linux.vnet.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Fixes: 20e4d81393196 ("blk-mq: simplify queue mapping & schedule with each possisble CPU")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
| -rw-r--r-- | block/blk-mq.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 90f869a083a4..f489ec920807 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
| @@ -2431,6 +2431,8 @@ static void blk_mq_map_swqueue(struct request_queue *q) | |||
| 2431 | */ | 2431 | */ |
| 2432 | hctx->next_cpu = cpumask_first_and(hctx->cpumask, | 2432 | hctx->next_cpu = cpumask_first_and(hctx->cpumask, |
| 2433 | cpu_online_mask); | 2433 | cpu_online_mask); |
| 2434 | if (hctx->next_cpu >= nr_cpu_ids) | ||
| 2435 | hctx->next_cpu = cpumask_first(hctx->cpumask); | ||
| 2434 | hctx->next_cpu_batch = BLK_MQ_CPU_WORK_BATCH; | 2436 | hctx->next_cpu_batch = BLK_MQ_CPU_WORK_BATCH; |
| 2435 | } | 2437 | } |
| 2436 | } | 2438 | } |
