diff mbox series

[v3,2/6] scsi: iscsi: use system_unbound_wq for destroy_work

Message ID 20210424221755.124438-3-michael.christie@oracle.com
State Superseded
Headers show
Series iscsi: Fix in kernel conn failure handling | expand

Commit Message

Mike Christie April 24, 2021, 10:17 p.m. UTC
Use the system_unbound_wq for async session destruction. We don't need a
dedicated workqueue for async session destruction because:

1. perf does not seem to be an issue since we only allow 1 active work.
2. it does not have deps with other system works and we can run them
in parallel with each other.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

Comments

Lee Duncan April 28, 2021, 7:02 p.m. UTC | #1
On 4/24/21 3:17 PM, Mike Christie wrote:
> Use the system_unbound_wq for async session destruction. We don't need a

> dedicated workqueue for async session destruction because:

> 

> 1. perf does not seem to be an issue since we only allow 1 active work.

> 2. it does not have deps with other system works and we can run them

> in parallel with each other.

> 

> Signed-off-by: Mike Christie <michael.christie@oracle.com>

> ---

>  drivers/scsi/scsi_transport_iscsi.c | 15 +--------------

>  1 file changed, 1 insertion(+), 14 deletions(-)

> 

> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c

> index 0cd9f2090993..a23fcf871ffd 100644

> --- a/drivers/scsi/scsi_transport_iscsi.c

> +++ b/drivers/scsi/scsi_transport_iscsi.c

> @@ -95,8 +95,6 @@ static DECLARE_WORK(stop_conn_work, stop_conn_work_fn);

>  static atomic_t iscsi_session_nr; /* sysfs session id for next new session */

>  static struct workqueue_struct *iscsi_eh_timer_workq;

>  

> -static struct workqueue_struct *iscsi_destroy_workq;

> -

>  static DEFINE_IDA(iscsi_sess_ida);

>  /*

>   * list of registered transports and lock that must

> @@ -3718,7 +3716,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)

>  			list_del_init(&session->sess_list);

>  			spin_unlock_irqrestore(&sesslock, flags);

>  

> -			queue_work(iscsi_destroy_workq, &session->destroy_work);

> +			queue_work(system_unbound_wq, &session->destroy_work);

>  		}

>  		break;

>  	case ISCSI_UEVENT_UNBIND_SESSION:

> @@ -4814,18 +4812,8 @@ static __init int iscsi_transport_init(void)

>  		goto release_nls;

>  	}

>  

> -	iscsi_destroy_workq = alloc_workqueue("%s",

> -			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,

> -			1, "iscsi_destroy");

> -	if (!iscsi_destroy_workq) {

> -		err = -ENOMEM;

> -		goto destroy_wq;

> -	}

> -

>  	return 0;

>  

> -destroy_wq:

> -	destroy_workqueue(iscsi_eh_timer_workq);

>  release_nls:

>  	netlink_kernel_release(nls);

>  unregister_flashnode_bus:

> @@ -4847,7 +4835,6 @@ static __init int iscsi_transport_init(void)

>  

>  static void __exit iscsi_transport_exit(void)

>  {

> -	destroy_workqueue(iscsi_destroy_workq);

>  	destroy_workqueue(iscsi_eh_timer_workq);

>  	netlink_kernel_release(nls);

>  	bus_unregister(&iscsi_flashnode_bus);

> 


Reviewed-by: Lee Duncan <lduncan@suse.com>
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 0cd9f2090993..a23fcf871ffd 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -95,8 +95,6 @@  static DECLARE_WORK(stop_conn_work, stop_conn_work_fn);
 static atomic_t iscsi_session_nr; /* sysfs session id for next new session */
 static struct workqueue_struct *iscsi_eh_timer_workq;
 
-static struct workqueue_struct *iscsi_destroy_workq;
-
 static DEFINE_IDA(iscsi_sess_ida);
 /*
  * list of registered transports and lock that must
@@ -3718,7 +3716,7 @@  iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
 			list_del_init(&session->sess_list);
 			spin_unlock_irqrestore(&sesslock, flags);
 
-			queue_work(iscsi_destroy_workq, &session->destroy_work);
+			queue_work(system_unbound_wq, &session->destroy_work);
 		}
 		break;
 	case ISCSI_UEVENT_UNBIND_SESSION:
@@ -4814,18 +4812,8 @@  static __init int iscsi_transport_init(void)
 		goto release_nls;
 	}
 
-	iscsi_destroy_workq = alloc_workqueue("%s",
-			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
-			1, "iscsi_destroy");
-	if (!iscsi_destroy_workq) {
-		err = -ENOMEM;
-		goto destroy_wq;
-	}
-
 	return 0;
 
-destroy_wq:
-	destroy_workqueue(iscsi_eh_timer_workq);
 release_nls:
 	netlink_kernel_release(nls);
 unregister_flashnode_bus:
@@ -4847,7 +4835,6 @@  static __init int iscsi_transport_init(void)
 
 static void __exit iscsi_transport_exit(void)
 {
-	destroy_workqueue(iscsi_destroy_workq);
 	destroy_workqueue(iscsi_eh_timer_workq);
 	netlink_kernel_release(nls);
 	bus_unregister(&iscsi_flashnode_bus);