]> git.baikalelectronics.ru Git - kernel.git/commit
SCSI: don't get target/host busy_count in scsi_mq_get_budget()
authorMing Lei <ming.lei@redhat.com>
Sat, 4 Nov 2017 01:55:34 +0000 (09:55 +0800)
committerJens Axboe <axboe@kernel.dk>
Sat, 4 Nov 2017 14:19:25 +0000 (08:19 -0600)
commitc3b5cf73882bfe84bb15134f989d1c0978052162
tree34ffcdb1ac15fef880c93219cc4f5df4fe1785c8
parent7efbff50aece3d1442e65402cb492ee3ec572191
SCSI: don't get target/host busy_count in scsi_mq_get_budget()

It is very expensive to atomic_inc/atomic_dec the host wide counter of
host->busy_count, and it should have been avoided via blk-mq's mechanism
of getting driver tag, which uses the more efficient way of sbitmap queue.

Also we don't check atomic_read(&sdev->device_busy) in scsi_mq_get_budget()
and don't run queue if the counter becomes zero, so IO hang may be caused
if all requests are completed just before the current SCSI device
is added to shost->starved_list.

Fixes: c44b535c696d(scsi: implement .get_budget and .put_budget for blk-mq)
Reported-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/scsi/scsi_lib.c