All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA: Remove redundant 'flush_workqueue()' calls
@ 2021-10-10 14:08 Christophe JAILLET
  2021-10-12  6:23 ` Leon Romanovsky
  2021-10-12 16:20 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-10-10 14:08 UTC (permalink / raw)
  To: dledford, jgg, bharat, yishaih, bmt, leon
  Cc: linux-rdma, linux-kernel, kernel-janitors, Christophe JAILLET

'destroy_workqueue()' already drains the queue before destroying it, so
there is no need to flush it explicitly.

Remove the redundant 'flush_workqueue()' calls.

This was generated with coccinelle:

@@
expression E;
@@
- 	flush_workqueue(E);
	destroy_workqueue(E);

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/infiniband/core/sa_query.c        | 1 -
 drivers/infiniband/hw/cxgb4/cm.c          | 1 -
 drivers/infiniband/hw/cxgb4/device.c      | 1 -
 drivers/infiniband/hw/mlx4/alias_GUID.c   | 4 +---
 drivers/infiniband/sw/siw/siw_cm.c        | 4 +---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 -
 6 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index a20b8108e160..4220a545387f 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -2261,7 +2261,6 @@ int ib_sa_init(void)
 void ib_sa_cleanup(void)
 {
 	cancel_delayed_work(&ib_nl_timed_work);
-	flush_workqueue(ib_nl_wq);
 	destroy_workqueue(ib_nl_wq);
 	mcast_cleanup();
 	ib_unregister_client(&sa_client);
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 291471d12197..913f39ee4416 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -4464,6 +4464,5 @@ int __init c4iw_cm_init(void)
 void c4iw_cm_term(void)
 {
 	WARN_ON(!list_empty(&timeout_list));
-	flush_workqueue(workq);
 	destroy_workqueue(workq);
 }
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index 541dbcf22d0e..80970a1738f8 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -1562,7 +1562,6 @@ static void __exit c4iw_exit_module(void)
 		kfree(ctx);
 	}
 	mutex_unlock(&dev_mutex);
-	flush_workqueue(reg_workq);
 	destroy_workqueue(reg_workq);
 	cxgb4_unregister_uld(CXGB4_ULD_RDMA);
 	c4iw_cm_term();
diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c
index 571d9c542024..e2e1f5daddc4 100644
--- a/drivers/infiniband/hw/mlx4/alias_GUID.c
+++ b/drivers/infiniband/hw/mlx4/alias_GUID.c
@@ -822,10 +822,8 @@ void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev)
 		}
 		spin_unlock_irqrestore(&sriov->alias_guid.ag_work_lock, flags);
 	}
-	for (i = 0 ; i < dev->num_ports; i++) {
-		flush_workqueue(dev->sriov.alias_guid.ports_guid[i].wq);
+	for (i = 0 ; i < dev->num_ports; i++)
 		destroy_workqueue(dev->sriov.alias_guid.ports_guid[i].wq);
-	}
 	ib_sa_unregister_client(dev->sriov.alias_guid.sa_client);
 	kfree(dev->sriov.alias_guid.sa_client);
 }
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index 7a5ed86ffc9f..7acdd3c3a599 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -1951,8 +1951,6 @@ int siw_cm_init(void)
 
 void siw_cm_exit(void)
 {
-	if (siw_cm_wq) {
-		flush_workqueue(siw_cm_wq);
+	if (siw_cm_wq)
 		destroy_workqueue(siw_cm_wq);
-	}
 }
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 0aa8629fdf62..9c9da5aa592a 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1997,7 +1997,6 @@ static void ipoib_ndo_uninit(struct net_device *dev)
 	if (priv->wq) {
 		/* See ipoib_mcast_carrier_on_task() */
 		WARN_ON(test_bit(IPOIB_FLAG_OPER_UP, &priv->flags));
-		flush_workqueue(priv->wq);
 		destroy_workqueue(priv->wq);
 		priv->wq = NULL;
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA: Remove redundant 'flush_workqueue()' calls
  2021-10-10 14:08 [PATCH] RDMA: Remove redundant 'flush_workqueue()' calls Christophe JAILLET
@ 2021-10-12  6:23 ` Leon Romanovsky
  2021-10-12 16:20 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2021-10-12  6:23 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: dledford, jgg, bharat, yishaih, bmt, linux-rdma, linux-kernel,
	kernel-janitors

On Sun, Oct 10, 2021 at 04:08:10PM +0200, Christophe JAILLET wrote:
> 'destroy_workqueue()' already drains the queue before destroying it, so
> there is no need to flush it explicitly.
> 
> Remove the redundant 'flush_workqueue()' calls.
> 
> This was generated with coccinelle:
> 
> @@
> expression E;
> @@
> - 	flush_workqueue(E);
> 	destroy_workqueue(E);
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/infiniband/core/sa_query.c        | 1 -
>  drivers/infiniband/hw/cxgb4/cm.c          | 1 -
>  drivers/infiniband/hw/cxgb4/device.c      | 1 -
>  drivers/infiniband/hw/mlx4/alias_GUID.c   | 4 +---
>  drivers/infiniband/sw/siw/siw_cm.c        | 4 +---
>  drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 -
>  6 files changed, 2 insertions(+), 10 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA: Remove redundant 'flush_workqueue()' calls
  2021-10-10 14:08 [PATCH] RDMA: Remove redundant 'flush_workqueue()' calls Christophe JAILLET
  2021-10-12  6:23 ` Leon Romanovsky
@ 2021-10-12 16:20 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2021-10-12 16:20 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: dledford, bharat, yishaih, bmt, leon, linux-rdma, linux-kernel,
	kernel-janitors

On Sun, Oct 10, 2021 at 04:08:10PM +0200, Christophe JAILLET wrote:
> 'destroy_workqueue()' already drains the queue before destroying it, so
> there is no need to flush it explicitly.
> 
> Remove the redundant 'flush_workqueue()' calls.
> 
> This was generated with coccinelle:
> 
> @@
> expression E;
> @@
> - 	flush_workqueue(E);
> 	destroy_workqueue(E);
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/core/sa_query.c        | 1 -
>  drivers/infiniband/hw/cxgb4/cm.c          | 1 -
>  drivers/infiniband/hw/cxgb4/device.c      | 1 -
>  drivers/infiniband/hw/mlx4/alias_GUID.c   | 4 +---
>  drivers/infiniband/sw/siw/siw_cm.c        | 4 +---
>  drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 -
>  6 files changed, 2 insertions(+), 10 deletions(-)

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-12 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-10 14:08 [PATCH] RDMA: Remove redundant 'flush_workqueue()' calls Christophe JAILLET
2021-10-12  6:23 ` Leon Romanovsky
2021-10-12 16:20 ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.