scsi: target: Replace lun_tg_pt_gp_lock with rcu in I/O path
authorMike Christie <michael.christie@oracle.com>
Thu, 30 Sep 2021 02:04:21 +0000 (21:04 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 19 Oct 2021 02:38:36 +0000 (22:38 -0400)
commit7324f47d4293ff50f489010735a4057defb1a5d6
tree67eadcd82db8a482dfba6802d7a05929288a0091
parent1283c0d1a32bb924324481586b5d6e8e76f676ba
scsi: target: Replace lun_tg_pt_gp_lock with rcu in I/O path

We are only holding the lun_tg_pt_gp_lock in target_alua_state_check() to
make sure tg_pt_gp is not freed from under us while we copy the state,
delay, ID values. We can instead use RCU here to access the tg_pt_gp.

With this patch IOPs can increase up to 10% for jobs like:

  fio  --filename=/dev/sdX  --direct=1 --rw=randrw --bs=4k \
    --ioengine=libaio --iodepth=64  --numjobs=N

when there are multiple sessions (running that fio command to each /dev/sdX
or using multipath and there are over 8 paths), or more than 8 queues for
the loop or vhost with multiple threads case and numjobs > 8.

Link: https://lore.kernel.org/r/20210930020422.92578-5-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_alua.c
include/target/target_core_base.h