linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
To: Matan Barak <matanb@mellanox.com>, Leon Romanovsky <leonro@mellanox.com>
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue
Date: Sat, 16 Jul 2016 13:29:20 +0530	[thread overview]
Message-ID: <20160716075920.GA4547@Karyakshetra> (raw)

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

             reply	other threads:[~2016-07-16  7:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-16  7:59 Bhaktipriya Shridhar [this message]
2016-07-17  5:13 ` [PATCH] net/mlx5_core/health: Remove deprecated create_singlethread_workqueue 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160716075920.GA4547@Karyakshetra \
    --to=bhaktipriya96@gmail.com \
    --cc=leonro@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matanb@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).