[openib-general] [PATCH] Optimize cma_process_remove()
Krishna Kumar
krkumar2 at in.ibm.com
Thu Sep 7 22:14:39 PDT 2006
Optimize cma_process_remove() by using the remove_list.
Signed-off-by: Krishna Kumar <krkumar2 at in.ibm.com>
diff -ruNp org/core/cma.c new/core/cma.c
--- org/core/cma.c 2006-09-08 09:52:30.000000000 +0530
+++ new/core/cma.c 2006-09-08 09:57:03.000000000 +0530
@@ -2332,7 +2332,7 @@ static int cma_remove_id_dev(struct rdma
static void cma_process_remove(struct cma_device *cma_dev)
{
struct list_head remove_list;
- struct rdma_id_private *id_priv;
+ struct rdma_id_private *id_priv, *tmp;
int ret;
INIT_LIST_HEAD(&remove_list);
@@ -2344,22 +2344,20 @@ static void cma_process_remove(struct cm
if (cma_internal_listen(id_priv)) {
cma_destroy_listen(id_priv);
- continue;
+ } else {
+ list_del(&id_priv->list);
+ list_add_tail(&id_priv->list, &remove_list);
}
+ }
+ mutex_unlock(&lock);
- list_del(&id_priv->list);
- list_add_tail(&id_priv->list, &remove_list);
+ list_for_each_entry_safe(id_priv, tmp, &remove_list, list) {
atomic_inc(&id_priv->refcount);
- mutex_unlock(&lock);
-
ret = cma_remove_id_dev(id_priv);
cma_deref_id(id_priv);
if (ret)
rdma_destroy_id(&id_priv->id);
-
- mutex_lock(&lock);
}
- mutex_unlock(&lock);
cma_deref_dev(cma_dev);
wait_for_completion(&cma_dev->comp);
More information about the general
mailing list