linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue
@ 2016-07-16  7:59 Bhaktipriya Shridhar
  2016-07-17  5:13 ` Leon Romanovsky
  0 siblings, 1 reply; 6+ messages in thread
From: Bhaktipriya Shridhar @ 2016-07-16  7:59 UTC (permalink / raw)
  To: Matan Barak, Leon Romanovsky; +Cc: netdev, linux-rdma, linux-kernel, Tejun Heo

The workqueue health->wq was used as per device private health thread.
This was done so that system error handling could be processed
concurrently. The workqueue has a single workitem(&health->work) and
hence doesn't require ordering. It is involved in handling the health of
the deviceand is not being used on a memory reclaim path.
Hence, the singlethreaded workqueue has been replaced with the use of
system_wq.

System workqueues have been able to handle high level of concurrency
for a long time now and hence it's not required to have a singlethreaded
workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
created with create_singlethread_workqueue(), system_wq allows multiple
work items to overlap executions even on the same CPU; however, a
per-cpu workqueue doesn't have any CPU locality or global ordering
guarantee unless the target CPU is explicitly specified and thus the
increase of local concurrency shouldn't make any difference.

Work item has been flushed in mlx5_health_cleanup() to ensure that
there are no pending tasks while disconnecting the driver.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/health.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
index 42d16b9..9acbccf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
@@ -267,7 +267,7 @@ static void poll_health(unsigned long data)
 	if (in_fatal(dev) && !health->sick) {
 		health->sick = true;
 		print_health_info(dev);
-		queue_work(health->wq, &health->work);
+		schedule_work(&health->work);
 	}
 }

@@ -296,7 +296,7 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev)
 {
 	struct mlx5_core_health *health = &dev->priv.health;

-	destroy_workqueue(health->wq);
+	flush_work(&health->work);
 }

 int mlx5_health_init(struct mlx5_core_dev *dev)
@@ -311,10 +311,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev)

 	strcpy(name, "mlx5_health");
 	strcat(name, dev_name(&dev->pdev->dev));
-	health->wq = create_singlethread_workqueue(name);
 	kfree(name);
-	if (!health->wq)
-		return -ENOMEM;

 	INIT_WORK(&health->work, health_care);

--
2.1.4

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

* Re: [PATCH] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue
  2016-07-16  7:59 [PATCH] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue Bhaktipriya Shridhar
@ 2016-07-17  5:13 ` Leon Romanovsky
  2016-07-17 13:35   ` Bhaktipriya Shridhar
  2016-07-26 17:08   ` [PATCH v2] " Bhaktipriya Shridhar
  0 siblings, 2 replies; 6+ messages in thread
From: Leon Romanovsky @ 2016-07-17  5:13 UTC (permalink / raw)
  To: Bhaktipriya Shridhar
  Cc: Matan Barak, netdev, linux-rdma, linux-kernel, Tejun Heo

[-- Attachment #1: Type: text/plain, Size: 2976 bytes --]

On Sat, Jul 16, 2016 at 01:29:20PM +0530, Bhaktipriya Shridhar wrote:
> The workqueue health->wq was used as per device private health thread.
> This was done so that system error handling could be processed
> concurrently.

Not exactly, AFAIK it was intended to perform delayed work and not
relevant to concurrency.

> The workqueue has a single workitem(&health->work) and
> hence doesn't require ordering. It is involved in handling the health of
> the deviceand is not being used on a memory reclaim path.
> Hence, the singlethreaded workqueue has been replaced with the use of
> system_wq.

Yes

> 
> System workqueues have been able to handle high level of concurrency
> for a long time now and hence it's not required to have a singlethreaded
> workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
> created with create_singlethread_workqueue(), system_wq allows multiple
> work items to overlap executions even on the same CPU; however, a
> per-cpu workqueue doesn't have any CPU locality or global ordering
> guarantee unless the target CPU is explicitly specified and thus the
> increase of local concurrency shouldn't make any difference.

Not relevant.

> 
> Work item has been flushed in mlx5_health_cleanup() to ensure that
> there are no pending tasks while disconnecting the driver.
> 
> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/health.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
> index 42d16b9..9acbccf 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
> @@ -267,7 +267,7 @@ static void poll_health(unsigned long data)
>  	if (in_fatal(dev) && !health->sick) {
>  		health->sick = true;
>  		print_health_info(dev);
> -		queue_work(health->wq, &health->work);
> +		schedule_work(&health->work);
>  	}
>  }
> 
> @@ -296,7 +296,7 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev)
>  {
>  	struct mlx5_core_health *health = &dev->priv.health;
> 
> -	destroy_workqueue(health->wq);
> +	flush_work(&health->work);
>  }
> 
>  int mlx5_health_init(struct mlx5_core_dev *dev)
> @@ -311,10 +311,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev)
> 
>  	strcpy(name, "mlx5_health");
>  	strcat(name, dev_name(&dev->pdev->dev));
> -	health->wq = create_singlethread_workqueue(name);
>  	kfree(name);

You need to remove "name" initialization/usage too.
It is not needed.

> -	if (!health->wq)
> -		return -ENOMEM;
> 
>  	INIT_WORK(&health->work, health_care);
> 
> --
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue
  2016-07-17  5:13 ` Leon Romanovsky
@ 2016-07-17 13:35   ` Bhaktipriya Shridhar
  2016-07-26 17:08   ` [PATCH v2] " Bhaktipriya Shridhar
  1 sibling, 0 replies; 6+ messages in thread
From: Bhaktipriya Shridhar @ 2016-07-17 13:35 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Matan Barak, netdev, linux-rdma, Linux-Kernel@Vger. Kernel. Org,
	Tejun Heo

Sure. Will make the changes in v2.

Thanks,
Bhaktipriya


On Sun, Jul 17, 2016 at 10:43 AM, Leon Romanovsky <leonro@mellanox.com> wrote:
> On Sat, Jul 16, 2016 at 01:29:20PM +0530, Bhaktipriya Shridhar wrote:
>> The workqueue health->wq was used as per device private health thread.
>> This was done so that system error handling could be processed
>> concurrently.
>
> Not exactly, AFAIK it was intended to perform delayed work and not
> relevant to concurrency.
>
>> The workqueue has a single workitem(&health->work) and
>> hence doesn't require ordering. It is involved in handling the health of
>> the deviceand is not being used on a memory reclaim path.
>> Hence, the singlethreaded workqueue has been replaced with the use of
>> system_wq.
>
> Yes
>
>>
>> System workqueues have been able to handle high level of concurrency
>> for a long time now and hence it's not required to have a singlethreaded
>> workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
>> created with create_singlethread_workqueue(), system_wq allows multiple
>> work items to overlap executions even on the same CPU; however, a
>> per-cpu workqueue doesn't have any CPU locality or global ordering
>> guarantee unless the target CPU is explicitly specified and thus the
>> increase of local concurrency shouldn't make any difference.
>
> Not relevant.
>
>>
>> Work item has been flushed in mlx5_health_cleanup() to ensure that
>> there are no pending tasks while disconnecting the driver.
>>
>> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
>> ---
>>  drivers/net/ethernet/mellanox/mlx5/core/health.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
>> index 42d16b9..9acbccf 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
>> @@ -267,7 +267,7 @@ static void poll_health(unsigned long data)
>>       if (in_fatal(dev) && !health->sick) {
>>               health->sick = true;
>>               print_health_info(dev);
>> -             queue_work(health->wq, &health->work);
>> +             schedule_work(&health->work);
>>       }
>>  }
>>
>> @@ -296,7 +296,7 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev)
>>  {
>>       struct mlx5_core_health *health = &dev->priv.health;
>>
>> -     destroy_workqueue(health->wq);
>> +     flush_work(&health->work);
>>  }
>>
>>  int mlx5_health_init(struct mlx5_core_dev *dev)
>> @@ -311,10 +311,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev)
>>
>>       strcpy(name, "mlx5_health");
>>       strcat(name, dev_name(&dev->pdev->dev));
>> -     health->wq = create_singlethread_workqueue(name);
>>       kfree(name);
>
> You need to remove "name" initialization/usage too.
> It is not needed.
>
>> -     if (!health->wq)
>> -             return -ENOMEM;
>>
>>       INIT_WORK(&health->work, health_care);
>>
>> --
>> 2.1.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue
  2016-07-17  5:13 ` Leon Romanovsky
  2016-07-17 13:35   ` Bhaktipriya Shridhar
@ 2016-07-26 17:08   ` Bhaktipriya Shridhar
  2016-07-26 18:11     ` Leon Romanovsky
  2016-07-26 22:19     ` David Miller
  1 sibling, 2 replies; 6+ messages in thread
From: Bhaktipriya Shridhar @ 2016-07-26 17:08 UTC (permalink / raw)
  To: Matan Barak, Leon Romanovsky; +Cc: netdev, linux-rdma, linux-kernel, Tejun Heo

The workqueue health->wq was used as per device private health thread.
This was done to perform delayed work.

The workqueue has a single workitem(&health->work) and
hence doesn't require ordering. It is involved in handling the health of
the device and is not being used on a memory reclaim path.
Hence, the singlethreaded workqueue has been replaced with the use of
system_wq.

Work item has been flushed in mlx5_health_cleanup() to ensure that
there are no pending tasks while disconnecting the driver.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
---
 Changes in v2:
	-Updated commit description as per the feedback received.

 drivers/net/ethernet/mellanox/mlx5/core/health.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
index 42d16b9..9acbccf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
@@ -267,7 +267,7 @@ static void poll_health(unsigned long data)
 	if (in_fatal(dev) && !health->sick) {
 		health->sick = true;
 		print_health_info(dev);
-		queue_work(health->wq, &health->work);
+		schedule_work(&health->work);
 	}
 }

@@ -296,7 +296,7 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev)
 {
 	struct mlx5_core_health *health = &dev->priv.health;

-	destroy_workqueue(health->wq);
+	flush_work(&health->work);
 }

 int mlx5_health_init(struct mlx5_core_dev *dev)
@@ -311,10 +311,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev)

 	strcpy(name, "mlx5_health");
 	strcat(name, dev_name(&dev->pdev->dev));
-	health->wq = create_singlethread_workqueue(name);
 	kfree(name);
-	if (!health->wq)
-		return -ENOMEM;

 	INIT_WORK(&health->work, health_care);

--
2.1.4

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

* Re: [PATCH v2] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue
  2016-07-26 17:08   ` [PATCH v2] " Bhaktipriya Shridhar
@ 2016-07-26 18:11     ` Leon Romanovsky
  2016-07-26 22:19     ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2016-07-26 18:11 UTC (permalink / raw)
  To: Bhaktipriya Shridhar
  Cc: Matan Barak, netdev, linux-rdma, linux-kernel, Tejun Heo

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

On Tue, Jul 26, 2016 at 10:38:24PM +0530, Bhaktipriya Shridhar wrote:
> The workqueue health->wq was used as per device private health thread.
> This was done to perform delayed work.
> 
> The workqueue has a single workitem(&health->work) and
> hence doesn't require ordering. It is involved in handling the health of
> the device and is not being used on a memory reclaim path.
> Hence, the singlethreaded workqueue has been replaced with the use of
> system_wq.
> 
> Work item has been flushed in mlx5_health_cleanup() to ensure that
> there are no pending tasks while disconnecting the driver.
> 
> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
> ---
>  Changes in v2:
> 	-Updated commit description as per the feedback received.
> 
>  drivers/net/ethernet/mellanox/mlx5/core/health.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Thanks,
Acked-by: Leon Romanovsky <leonro@mellanox.com>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v2] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue
  2016-07-26 17:08   ` [PATCH v2] " Bhaktipriya Shridhar
  2016-07-26 18:11     ` Leon Romanovsky
@ 2016-07-26 22:19     ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2016-07-26 22:19 UTC (permalink / raw)
  To: bhaktipriya96; +Cc: matanb, leonro, netdev, linux-rdma, linux-kernel, tj

From: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Date: Tue, 26 Jul 2016 22:38:24 +0530

> The workqueue health->wq was used as per device private health thread.
> This was done to perform delayed work.
> 
> The workqueue has a single workitem(&health->work) and
> hence doesn't require ordering. It is involved in handling the health of
> the device and is not being used on a memory reclaim path.
> Hence, the singlethreaded workqueue has been replaced with the use of
> system_wq.
> 
> Work item has been flushed in mlx5_health_cleanup() to ensure that
> there are no pending tasks while disconnecting the driver.
> 
> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>

Applied.

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

end of thread, other threads:[~2016-07-26 22:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-16  7:59 [PATCH] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue Bhaktipriya Shridhar
2016-07-17  5:13 ` Leon Romanovsky
2016-07-17 13:35   ` Bhaktipriya Shridhar
2016-07-26 17:08   ` [PATCH v2] " Bhaktipriya Shridhar
2016-07-26 18:11     ` Leon Romanovsky
2016-07-26 22:19     ` David Miller

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).