Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1c735fb authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe
Browse files

blk-mq: make sure that correct hctx->next_cpu is set



From commit 20e4d813 (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: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Fixes: 20e4d813 ("blk-mq: simplify queue mapping & schedule with each possisble CPU")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent bdac616d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2431,6 +2431,8 @@ static void blk_mq_map_swqueue(struct request_queue *q)
		 */
		hctx->next_cpu = cpumask_first_and(hctx->cpumask,
				cpu_online_mask);
		if (hctx->next_cpu >= nr_cpu_ids)
			hctx->next_cpu = cpumask_first(hctx->cpumask);
		hctx->next_cpu_batch = BLK_MQ_CPU_WORK_BATCH;
	}
}