diff mbox series

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

Message ID 20210914105539.6942-4-d.bogdanov@yadro.com (mailing list archive)
State Accepted
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>
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);