linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme-core: cleanup work queue flags
@ 2019-08-31  0:02 Chaitanya Kulkarni
  2019-09-01 14:03 ` Max Gurtovoy
  2019-09-02 16:13 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2019-08-31  0:02 UTC (permalink / raw)
  To: linux-nvme; +Cc: Chaitanya Kulkarni

Over the period of time there are three workqueues been added to the
nvme-core which all share same flags :-

nvme-wq :-
commit 9a6327d2f25b ("nvme: Move transports to use nvme-core workqueue")

nvme-reset-wq :-
nvme-delete-wq :-
commit b227c59b9b5b
("nvme: host delete_work and reset_work on separate workqueues")

This is a pure cleanup patch which defines a new macro for common
workqueue flags used to initialize for nvme-wq, nvme-reset-wq,
nvme-delete-wq and avoids the repetition of the flags in 
nvme_core_init().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/nvme/host/core.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 0b1ff8d54e48..555d9efa76cd 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -61,6 +61,7 @@ static bool streams;
 module_param(streams, bool, 0644);
 MODULE_PARM_DESC(streams, "turn on support for Streams write directives");
 
+#define NVME_WQ_FLAGS (WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS)
 /*
  * nvme_wq - hosts nvme related works that are not reset or delete
  * nvme_reset_wq - hosts nvme reset works
@@ -4055,18 +4056,15 @@ static int __init nvme_core_init(void)
 
 	_nvme_check_size();
 
-	nvme_wq = alloc_workqueue("nvme-wq",
-			WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
+	nvme_wq = alloc_workqueue("nvme-wq", NVME_WQ_FLAGS, 0);
 	if (!nvme_wq)
 		goto out;
 
-	nvme_reset_wq = alloc_workqueue("nvme-reset-wq",
-			WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
+	nvme_reset_wq = alloc_workqueue("nvme-reset-wq", NVME_WQ_FLAGS, 0);
 	if (!nvme_reset_wq)
 		goto destroy_wq;
 
-	nvme_delete_wq = alloc_workqueue("nvme-delete-wq",
-			WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
+	nvme_delete_wq = alloc_workqueue("nvme-delete-wq", NVME_WQ_FLAGS, 0);
 	if (!nvme_delete_wq)
 		goto destroy_reset_wq;
 
-- 
2.17.0


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvme-core: cleanup work queue flags
  2019-08-31  0:02 [PATCH] nvme-core: cleanup work queue flags Chaitanya Kulkarni
@ 2019-09-01 14:03 ` Max Gurtovoy
  2019-09-02 16:13 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Max Gurtovoy @ 2019-09-01 14:03 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-nvme


On 8/31/2019 3:02 AM, Chaitanya Kulkarni wrote:
> Over the period of time there are three workqueues been added to the
> nvme-core which all share same flags :-
>
> nvme-wq :-
> commit 9a6327d2f25b ("nvme: Move transports to use nvme-core workqueue")
>
> nvme-reset-wq :-
> nvme-delete-wq :-
> commit b227c59b9b5b
> ("nvme: host delete_work and reset_work on separate workqueues")

I don't think we need the first half of commit message.


> This is a pure cleanup patch which defines a new macro for common
> workqueue flags used to initialize for nvme-wq, nvme-reset-wq,
> nvme-delete-wq and avoids the repetition of the flags in
> nvme_core_init().
>
> Signed-off-by: Chaitanya Kulkarni<chaitanya.kulkarni@wdc.com>
> ---
>   drivers/nvme/host/core.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 0b1ff8d54e48..555d9efa76cd 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -61,6 +61,7 @@ static bool streams;
>   module_param(streams, bool, 0644);
>   MODULE_PARM_DESC(streams, "turn on support for Streams write directives");
>   
> +#define NVME_WQ_FLAGS (WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS)
>   /*
>    * nvme_wq - hosts nvme related works that are not reset or delete
>    * nvme_reset_wq - hosts nvme reset works
> @@ -4055,18 +4056,15 @@ static int __init nvme_core_init(void)
>   
>   	_nvme_check_size();
>   
> -	nvme_wq = alloc_workqueue("nvme-wq",
> -			WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
> +	nvme_wq = alloc_workqueue("nvme-wq", NVME_WQ_FLAGS, 0);
>   	if (!nvme_wq)
>   		goto out;
>   
> -	nvme_reset_wq = alloc_workqueue("nvme-reset-wq",
> -			WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
> +	nvme_reset_wq = alloc_workqueue("nvme-reset-wq", NVME_WQ_FLAGS, 0);
>   	if (!nvme_reset_wq)
>   		goto destroy_wq;
>   
> -	nvme_delete_wq = alloc_workqueue("nvme-delete-wq",
> -			WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
> +	nvme_delete_wq = alloc_workqueue("nvme-delete-wq", NVME_WQ_FLAGS, 0);
>   	if (!nvme_delete_wq)
>   		goto destroy_reset_wq;
>   


Otherwise Looks good,

Reviewed-by: Max Gurtovoy <maxg@mellanox.com>



_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvme-core: cleanup work queue flags
  2019-08-31  0:02 [PATCH] nvme-core: cleanup work queue flags Chaitanya Kulkarni
  2019-09-01 14:03 ` Max Gurtovoy
@ 2019-09-02 16:13 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-09-02 16:13 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-nvme

s/-core// in the subject, please.

On Fri, Aug 30, 2019 at 05:02:35PM -0700, Chaitanya Kulkarni wrote:
> Over the period of time there are three workqueues been added to the
> nvme-core which all share same flags :-
> 
> nvme-wq :-
> commit 9a6327d2f25b ("nvme: Move transports to use nvme-core workqueue")
> 
> nvme-reset-wq :-
> nvme-delete-wq :-
> commit b227c59b9b5b
> ("nvme: host delete_work and reset_work on separate workqueues")
> 
> This is a pure cleanup patch which defines a new macro for common
> workqueue flags used to initialize for nvme-wq, nvme-reset-wq,
> nvme-delete-wq and avoids the repetition of the flags in 
> nvme_core_init().

There is nothing inheritly nvme about the workqueue flags, so I don't
think this define is a good idea.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2019-09-02 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-31  0:02 [PATCH] nvme-core: cleanup work queue flags Chaitanya Kulkarni
2019-09-01 14:03 ` Max Gurtovoy
2019-09-02 16:13 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).