OSDN Git Service

scsi: core: Avoid calling synchronize_rcu() for each device in scsi_host_block()
authorMing Lei <ming.lei@redhat.com>
Thu, 23 Apr 2020 02:07:13 +0000 (10:07 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 24 Apr 2020 22:21:15 +0000 (18:21 -0400)
commitf983622ae60516d634008c7b1ff9ffff4f7bb8ae
tree11f5a5aa347e1ebec3429d67f33665c3b4283ced
parent3fa65812c20297bf71724c6138c0aed8531012f9
scsi: core: Avoid calling synchronize_rcu() for each device in scsi_host_block()

scsi_host_block() calls scsi_internal_device_block() for each scsi_device and
scsi_internal_device_block() calls blk_mq_quiesce_queue() for each LUN.

Since synchronize_rcu() is called from blk_mq_quiesce_queue(), this can cause
substantial slowdowns on systems with many LUNs.

Use scsi_internal_device_block_nowait() to implement scsi_host_block() so it
is sufficient to run synchronize_rcu() once. This is safe since SCSI does not
set the BLK_MQ_F_BLOCKING flag.

[mkp: commit desc and comment tweaks]

Link: https://lore.kernel.org/r/20200423020713.332743-1-ming.lei@redhat.com
Cc: Steffen Maier <maier@linux.ibm.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c