Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1345239 > unrolled thread

[RFC] staging: unisys: visornic: Remove create_singlethread_workqueue()

Started byAmitoj Kaur Chawla <amitoj1606@gmail.com>
First post2016-02-28 14:00 +0100
Last post2016-02-28 23:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [RFC] staging: unisys: visornic: Remove  create_singlethread_workqueue() Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-02-28 14:00 +0100
    RE: [RFC] staging: unisys: visornic: Remove  create_singlethread_workqueue() "Kershner, David A" <David.Kershner@unisys.com> - 2016-02-28 23:10 +0100

#1345239 — [RFC] staging: unisys: visornic: Remove create_singlethread_workqueue()

FromAmitoj Kaur Chawla <amitoj1606@gmail.com>
Date2016-02-28 14:00 +0100
Subject[RFC] staging: unisys: visornic: Remove create_singlethread_workqueue()
Message-ID<r7974-2qK-19@gated-at.bofh.it>
With concurrency managed workqueues, use of dedicated workqueues
can be replaced by using system_wq.
Drop visornic_timeout_reset_workqueue by using system_wq.

Since there is only one work item per devdata and different
devdatas do not need to be ordered, increase of concurrency
level by switching to system_wq should not break anything.

cancel_work_sync() is used to ensure that work is not pending or
executing on any CPU.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
---
Only compile tested.

 drivers/staging/unisys/visornic/visornic_main.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index df4f688..6749c4e 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -59,8 +59,6 @@ static const struct file_operations debugfs_enable_ints_fops = {
 	.write = enable_ints_write,
 };
 
-static struct workqueue_struct *visornic_timeout_reset_workqueue;
-
 /* GUIDS for director channel type supported by this driver.  */
 static struct visor_channeltype_descriptor visornic_channel_types[] = {
 	/* Note that the only channel type we expect to be reported by the
@@ -1070,7 +1068,7 @@ visornic_xmit_timeout(struct net_device *netdev)
 		spin_unlock_irqrestore(&devdata->priv_lock, flags);
 		return;
 	}
-	queue_work(visornic_timeout_reset_workqueue, &devdata->timeout_reset);
+	schedule_work(&devdata->timeout_reset);
 	spin_unlock_irqrestore(&devdata->priv_lock, flags);
 }
 
@@ -1998,7 +1996,7 @@ static void visornic_remove(struct visor_device *dev)
 	}
 
 	/* going_away prevents new items being added to the workqueues */
-	flush_workqueue(visornic_timeout_reset_workqueue);
+	cancel_work_sync(&devdata->timeout_reset);
 
 	debugfs_remove_recursive(devdata->eth_debugfs_dir);
 
@@ -2117,21 +2115,10 @@ static int visornic_init(void)
 	if (!ret)
 		goto cleanup_debugfs;
 
-	/* create workqueue for tx timeout reset */
-	visornic_timeout_reset_workqueue =
-		create_singlethread_workqueue("visornic_timeout_reset");
-	if (!visornic_timeout_reset_workqueue)
-		goto cleanup_workqueue;
-
 	err = visorbus_register_visor_driver(&visornic_driver);
 	if (!err)
 		return 0;
 
-cleanup_workqueue:
-	if (visornic_timeout_reset_workqueue) {
-		flush_workqueue(visornic_timeout_reset_workqueue);
-		destroy_workqueue(visornic_timeout_reset_workqueue);
-	}
 cleanup_debugfs:
 	debugfs_remove_recursive(visornic_debugfs_dir);
 
@@ -2147,10 +2134,6 @@ static void visornic_cleanup(void)
 {
 	visorbus_unregister_visor_driver(&visornic_driver);
 
-	if (visornic_timeout_reset_workqueue) {
-		flush_workqueue(visornic_timeout_reset_workqueue);
-		destroy_workqueue(visornic_timeout_reset_workqueue);
-	}
 	debugfs_remove_recursive(visornic_debugfs_dir);
 }
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1345411

From"Kershner, David A" <David.Kershner@unisys.com>
Date2016-02-28 23:10 +0100
Message-ID<r7hHk-HU-31@gated-at.bofh.it>
In reply to#1345239
> -----Original Message-----
> From: Amitoj Kaur Chawla [mailto:amitoj1606@gmail.com]
> Sent: Sunday, February 28, 2016 7:57 AM
> To: Romer, Benjamin M <Benjamin.Romer@unisys.com>;
> Jes.Sorensen@redhat.com; Arfvidson, Erik <Erik.Arfvidson@unisys.com>;
> Kershner, David A <David.Kershner@unisys.com>; jkc@redhat.com; Sell,
> Timothy C <Timothy.Sell@unisys.com>; Thompson, Bryan E.
> <bryan.thompson@unisys.com>; dzickus@redhat.com;
> gregkh@linuxfoundation.org; *S-Par-Maintainer
> <SParMaintainer@unisys.com>; devel@driverdev.osuosl.org; linux-
> kernel@vger.kernel.org
> Cc: tj@kernel.org; outreachy-kernel@googlegroups.com
> Subject: [RFC] staging: unisys: visornic: Remove
> create_singlethread_workqueue()
> 
> With concurrency managed workqueues, use of dedicated workqueues
> can be replaced by using system_wq.
> Drop visornic_timeout_reset_workqueue by using system_wq.
> 
> Since there is only one work item per devdata and different
> devdatas do not need to be ordered, increase of concurrency
> level by switching to system_wq should not break anything.
> 
> cancel_work_sync() is used to ensure that work is not pending or
> executing on any CPU.
> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> Acked-by: Tejun Heo <tj@kernel.org>

Tested on s-Par system, no issues found. 

Tested-by: David Kershner <david.kershner@unisys.com>

> ---
> Only compile tested.
> 
>  drivers/staging/unisys/visornic/visornic_main.c | 21 ++-------------------
>  1 file changed, 2 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/staging/unisys/visornic/visornic_main.c
> b/drivers/staging/unisys/visornic/visornic_main.c
> index df4f688..6749c4e 100644
> --- a/drivers/staging/unisys/visornic/visornic_main.c
> +++ b/drivers/staging/unisys/visornic/visornic_main.c
> @@ -59,8 +59,6 @@ static const struct file_operations
> debugfs_enable_ints_fops = {
>  	.write = enable_ints_write,
>  };
> 
> -static struct workqueue_struct *visornic_timeout_reset_workqueue;
> -
>  /* GUIDS for director channel type supported by this driver.  */
>  static struct visor_channeltype_descriptor visornic_channel_types[] = {
>  	/* Note that the only channel type we expect to be reported by the
> @@ -1070,7 +1068,7 @@ visornic_xmit_timeout(struct net_device *netdev)
>  		spin_unlock_irqrestore(&devdata->priv_lock, flags);
>  		return;
>  	}
> -	queue_work(visornic_timeout_reset_workqueue, &devdata-
> >timeout_reset);
> +	schedule_work(&devdata->timeout_reset);
>  	spin_unlock_irqrestore(&devdata->priv_lock, flags);
>  }
> 
> @@ -1998,7 +1996,7 @@ static void visornic_remove(struct visor_device
> *dev)
>  	}
> 
>  	/* going_away prevents new items being added to the workqueues
> */
> -	flush_workqueue(visornic_timeout_reset_workqueue);
> +	cancel_work_sync(&devdata->timeout_reset);
> 
>  	debugfs_remove_recursive(devdata->eth_debugfs_dir);
> 
> @@ -2117,21 +2115,10 @@ static int visornic_init(void)
>  	if (!ret)
>  		goto cleanup_debugfs;
> 
> -	/* create workqueue for tx timeout reset */
> -	visornic_timeout_reset_workqueue =
> -		create_singlethread_workqueue("visornic_timeout_reset");
> -	if (!visornic_timeout_reset_workqueue)
> -		goto cleanup_workqueue;
> -
>  	err = visorbus_register_visor_driver(&visornic_driver);
>  	if (!err)
>  		return 0;
> 
> -cleanup_workqueue:
> -	if (visornic_timeout_reset_workqueue) {
> -		flush_workqueue(visornic_timeout_reset_workqueue);
> -		destroy_workqueue(visornic_timeout_reset_workqueue);
> -	}
>  cleanup_debugfs:
>  	debugfs_remove_recursive(visornic_debugfs_dir);
> 
> @@ -2147,10 +2134,6 @@ static void visornic_cleanup(void)
>  {
>  	visorbus_unregister_visor_driver(&visornic_driver);
> 
> -	if (visornic_timeout_reset_workqueue) {
> -		flush_workqueue(visornic_timeout_reset_workqueue);
> -		destroy_workqueue(visornic_timeout_reset_workqueue);
> -	}
>  	debugfs_remove_recursive(visornic_debugfs_dir);
>  }
> 
> --
> 1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web