Thread (8 messages) 8 messages, 3 authors, 2021-09-29
STALE1752d LANDED: 1 (0M)

[PATCH 3/3] scsi: efct: decrease area under spinlock

From: Dmitry Bogdanov <hidden>
Date: 2021-09-14 10:55:56
Also in: target-devel
Subsystem: emulex/broadcom efct fc/fcoe scsi target driver, scsi subsystem, the rest · Maintainers: Ram Vegesna, "James E.J. Bottomley", "Martin K. Petersen", Linus Torvalds

Under session level spinlock node->active_ios_lock in
efct_scsi_io_alloc() there is a getting other spinlock of port level.
That lead to competition between sessions and even between IOs in the
same session due too much instructions under spinlock.

This change reduces spinlock area just to active_ios list for which
active_ios_lock is intended.
Spinlock CPU usage is decreased from 18% down to 13% in efct driver.
IOPS are increased from 220 kIOPS upto 264 kIOPS for one lun on my setup.

Reviewed-by: Roman Bolshakov <redacted>
Signed-off-by: Dmitry Bogdanov <redacted>
---
 drivers/scsi/elx/efct/efct_scsi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/elx/efct/efct_scsi.c b/drivers/scsi/elx/efct/efct_scsi.c
index 40fb3a724c76..8535bb7eabd8 100644
--- a/drivers/scsi/elx/efct/efct_scsi.c
+++ b/drivers/scsi/elx/efct/efct_scsi.c
@@ -38,8 +38,6 @@ efct_scsi_io_alloc(struct efct_node *node)
 
 	xport = efct->xport;
 
-	spin_lock_irqsave(&node->active_ios_lock, flags);
-
 	io = efct_io_pool_io_alloc(efct->xport->io_pool);
 	if (!io) {
 		efc_log_err(efct, "IO alloc Failed\n");
@@ -66,6 +64,7 @@ efct_scsi_io_alloc(struct efct_node *node)
 
 	/* Add to node's active_ios list */
 	INIT_LIST_HEAD(&io->list_entry);
+	spin_lock_irqsave(&node->active_ios_lock, flags);
 	list_add(&io->list_entry, &node->active_ios);
 
 	spin_unlock_irqrestore(&node->active_ios_lock, flags);
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help