scsi: ufs: Optimize SCSI command processing
authorBart Van Assche <bvanassche@acm.org>
Thu, 22 Jul 2021 03:34:34 +0000 (20:34 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 3 Aug 2021 01:43:59 +0000 (21:43 -0400)
commit169f5eb28869098ac02d7e03abea36e8ac599bcc
treef8150ff360201fd1b138fb5da0a2eb61aa68d20e
parenta024ad0d49550e4ea1156e677cd9382e1eefbdd7
scsi: ufs: Optimize SCSI command processing

Use a spinlock to protect hba->outstanding_reqs instead of using atomic
operations to update this member variable.

This patch is a performance improvement because it reduces the number of
atomic operations in the hot path (test_and_clear_bit()) and because it
reduces the lock contention on the SCSI host lock. On my test setup this
patch improves IOPS by about 1%.

Link: https://lore.kernel.org/r/20210722033439.26550-14-bvanassche@acm.org
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Stanley Chu <stanley.chu@mediatek.com>
Cc: Can Guo <cang@codeaurora.org>
Cc: Asutosh Das <asutoshd@codeaurora.org>
Cc: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Daejun Park <daejun7.park@samsung.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h