diff mbox series

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

Message ID 20210914105539.6942-4-d.bogdanov@yadro.com
State New
Headers show
Series efct fixes & improvements | expand

Commit Message

Dmitry Bogdanov Sept. 14, 2021, 10:55 a.m. UTC
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 <r.bolshakov@yadro.com>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
---
 drivers/scsi/elx/efct/efct_scsi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ram Kishore Vegesna Sept. 15, 2021, 12:51 p.m. UTC | #1
On Tue, Sep 14, 2021 at 4:25 PM Dmitry Bogdanov <d.bogdanov@yadro.com> wrote:
>

> 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 <r.bolshakov@yadro.com>

> Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>

> ---

>  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

>

Looks good. Thanks.

Reviewed-by: Ram Vegesna <ram.vegesna@broadcom.com>


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
diff mbox series

Patch

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);