[PATCH RFC] RDMA: use alloc[_ordered]_workqueue()

From: Tejun Heo
Date: Mon Jan 24 2011 - 06:12:54 EST


Replace create[_singlethread]_workqueue() usages with the new
alloc[_ordered]_workqueue(). This removes rescuers from all
infiniband workqueues.

Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
Cc: Roland Dreier <rolandd@xxxxxxxxx>
Cc: Sean Hefty <sean.hefty@xxxxxxxxx>
Cc: Hal Rosenstock <hal.rosenstock@xxxxxxxxx>
---
Hello,

So, all the create* -> alloc* conversions were dropped (one
flush_scheduled_work() conversion was incorrectly dropped in the
process, fixed by the other patch). Was this because of forward
progress under memory pressure guarantee?

It doesn't look like infiniband can be safely used in memory reclaim
path anyway (ie. it doesn't seem safe to host swap space) but I could
definitely be mistaken. If forward progress is necessary, the right
thing to do is adding WQ_MEM_RECLAIM flag to workqueue allocation
calls.

Thank you.

drivers/infiniband/core/addr.c | 2 +-
drivers/infiniband/core/cm.c | 2 +-
drivers/infiniband/core/cma.c | 2 +-
drivers/infiniband/core/iwcm.c | 2 +-
drivers/infiniband/core/mad.c | 2 +-
drivers/infiniband/core/multicast.c | 2 +-
drivers/infiniband/hw/cxgb3/iwch_cm.c | 2 +-
drivers/infiniband/hw/cxgb4/cm.c | 2 +-
drivers/infiniband/hw/mlx4/main.c | 2 +-
drivers/infiniband/hw/mthca/mthca_catas.c | 2 +-
drivers/infiniband/hw/nes/nes_cm.c | 4 ++--
drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +-
12 files changed, 13 insertions(+), 13 deletions(-)

Index: work/drivers/infiniband/core/addr.c
===================================================================
--- work.orig/drivers/infiniband/core/addr.c
+++ work/drivers/infiniband/core/addr.c
@@ -438,7 +438,7 @@ static struct notifier_block nb = {

static int __init addr_init(void)
{
- addr_wq = create_singlethread_workqueue("ib_addr");
+ addr_wq = alloc_ordered_workqueue("ib_addr", 0);
if (!addr_wq)
return -ENOMEM;

Index: work/drivers/infiniband/core/cma.c
===================================================================
--- work.orig/drivers/infiniband/core/cma.c
+++ work/drivers/infiniband/core/cma.c
@@ -3257,7 +3257,7 @@ static int __init cma_init(void)
{
int ret;

- cma_wq = create_singlethread_workqueue("rdma_cm");
+ cma_wq = alloc_ordered_workqueue("rdma_cm", 0);
if (!cma_wq)
return -ENOMEM;

Index: work/drivers/infiniband/core/iwcm.c
===================================================================
--- work.orig/drivers/infiniband/core/iwcm.c
+++ work/drivers/infiniband/core/iwcm.c
@@ -1015,7 +1015,7 @@ EXPORT_SYMBOL(iw_cm_init_qp_attr);

static int __init iw_cm_init(void)
{
- iwcm_wq = create_singlethread_workqueue("iw_cm_wq");
+ iwcm_wq = alloc_ordered_workqueue("iw_cm_wq", 0);
if (!iwcm_wq)
return -ENOMEM;

Index: work/drivers/infiniband/core/mad.c
===================================================================
--- work.orig/drivers/infiniband/core/mad.c
+++ work/drivers/infiniband/core/mad.c
@@ -2839,7 +2839,7 @@ static int ib_mad_port_open(struct ib_de
goto error7;

snprintf(name, sizeof name, "ib_mad%d", port_num);
- port_priv->wq = create_singlethread_workqueue(name);
+ port_priv->wq = alloc_ordered_workqueue(name, 0);
if (!port_priv->wq) {
ret = -ENOMEM;
goto error8;
Index: work/drivers/infiniband/core/multicast.c
===================================================================
--- work.orig/drivers/infiniband/core/multicast.c
+++ work/drivers/infiniband/core/multicast.c
@@ -872,7 +872,7 @@ int mcast_init(void)
{
int ret;

- mcast_wq = create_singlethread_workqueue("ib_mcast");
+ mcast_wq = alloc_ordered_workqueue("ib_mcast", 0);
if (!mcast_wq)
return -ENOMEM;

Index: work/drivers/infiniband/hw/cxgb3/iwch_cm.c
===================================================================
--- work.orig/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ work/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -2236,7 +2236,7 @@ int __init iwch_cm_init(void)
{
skb_queue_head_init(&rxq);

- workq = create_singlethread_workqueue("iw_cxgb3");
+ workq = alloc_ordered_workqueue("iw_cxgb3", 0);
if (!workq)
return -ENOMEM;

Index: work/drivers/infiniband/hw/cxgb4/cm.c
===================================================================
--- work.orig/drivers/infiniband/hw/cxgb4/cm.c
+++ work/drivers/infiniband/hw/cxgb4/cm.c
@@ -2356,7 +2356,7 @@ int __init c4iw_cm_init(void)
spin_lock_init(&timeout_lock);
skb_queue_head_init(&rxq);

- workq = create_singlethread_workqueue("iw_cxgb4");
+ workq = alloc_ordered_workqueue("iw_cxgb4", 0);
if (!workq)
return -ENOMEM;

Index: work/drivers/infiniband/hw/mlx4/main.c
===================================================================
--- work.orig/drivers/infiniband/hw/mlx4/main.c
+++ work/drivers/infiniband/hw/mlx4/main.c
@@ -1214,7 +1214,7 @@ static int __init mlx4_ib_init(void)
{
int err;

- wq = create_singlethread_workqueue("mlx4_ib");
+ wq = alloc_ordered_workqueue("mlx4_ib", 0);
if (!wq)
return -ENOMEM;

Index: work/drivers/infiniband/hw/mthca/mthca_catas.c
===================================================================
--- work.orig/drivers/infiniband/hw/mthca/mthca_catas.c
+++ work/drivers/infiniband/hw/mthca/mthca_catas.c
@@ -186,7 +186,7 @@ int __init mthca_catas_init(void)
{
INIT_WORK(&catas_work, catas_reset);

- catas_wq = create_singlethread_workqueue("mthca_catas");
+ catas_wq = alloc_ordered_workqueue("mthca_catas", 0);
if (!catas_wq)
return -ENOMEM;

Index: work/drivers/infiniband/hw/nes/nes_cm.c
===================================================================
--- work.orig/drivers/infiniband/hw/nes/nes_cm.c
+++ work/drivers/infiniband/hw/nes/nes_cm.c
@@ -2381,10 +2381,10 @@ static struct nes_cm_core *nes_cm_alloc_
nes_debug(NES_DBG_CM, "Init CM Core completed -- cm_core=%p\n", cm_core);

nes_debug(NES_DBG_CM, "Enable QUEUE EVENTS\n");
- cm_core->event_wq = create_singlethread_workqueue("nesewq");
+ cm_core->event_wq = alloc_ordered_workqueue("nesewq", 0);
cm_core->post_event = nes_cm_post_event;
nes_debug(NES_DBG_CM, "Enable QUEUE DISCONNECTS\n");
- cm_core->disconn_wq = create_singlethread_workqueue("nesdwq");
+ cm_core->disconn_wq = alloc_ordered_workqueue("nesdwq", 0);

print_core(cm_core);
return cm_core;
Index: work/drivers/infiniband/ulp/ipoib/ipoib_main.c
===================================================================
--- work.orig/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ work/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1374,7 +1374,7 @@ static int __init ipoib_init_module(void
* so flush_scheduled_work() can deadlock during device
* removal.
*/
- ipoib_workqueue = create_singlethread_workqueue("ipoib");
+ ipoib_workqueue = alloc_ordered_workqueue("ipoib", 0);
if (!ipoib_workqueue) {
ret = -ENOMEM;
goto err_fs;
Index: work/drivers/infiniband/core/cm.c
===================================================================
--- work.orig/drivers/infiniband/core/cm.c
+++ work/drivers/infiniband/core/cm.c
@@ -3804,7 +3804,7 @@ static int __init ib_cm_init(void)
if (ret)
return -ENOMEM;

- cm.wq = create_workqueue("ib_cm");
+ cm.wq = alloc_workqueue("ib_cm", 0, 0);
if (!cm.wq) {
ret = -ENOMEM;
goto error1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/