]> asedeno.scripts.mit.edu Git - linux.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)
commit826a70a08b1210bbfdbda812ab43eb986e25b5c2
tree34ffcdb1ac15fef880c93219cc4f5df4fe1785c8
parente4f36b249b4d4e7599f1cf0c8fb50f196e52677e
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: 0df21c86bdbf(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